def run_main_loop(): # Initialize broker.init() db.reset_db() # Begin main loop of polling current price data then acting on it while t_trader_running: test_strategy.tick_action() time.sleep(WAIT_TIME)
def start_server(): import os from settings import curdir, db_url from db import reset_db print("Starting in %s" % curdir) if os.path.exists(db_url): print("With database %s" % db_url) else: reset_db(blank=True) app.run(host=host, port=port, debug=debug)
def setUp(self): super(TestStore, self).setUp() reset_db() self.app = app self.sess = Session() self.simulate_post('/register', params={ 'name': 'test', 'password': '******' }) auth = self.simulate_post('/auth', params={ 'name': 'test', 'password': '******' }, headers={'Content-Type': 'application/json'}) self.headers = { 'Authorization': 'JWT {}'.format(auth.json['access_token']) }
def main(): server = os.getenv("CASSANDRA_POOL") db.reset_db('%s:%s' % (server, "9160"))
import discord import sqlalchemy import re from config import config_get from db import Session, reset_db, Message reset_db() s = Session() config = config_get() def all(iterable, func): for x in iterable: if not func(x): return False return True def strip(iterable): for x in iterable: yield x.strip() class R9kBot(discord.Client): async def on_ready(self): print('Logged on as', self.user) async def on_message(self, message): if message.author == self.user:
def setUp(self): super(TestUser, self).setUp() reset_db() self.app = app
def setUp(self): db.reset_db()
def setUp(self): reset_db() self.sess = Session()
def setUp(self): db.reset_db(test_db) db.add_subs(test_data)
def init_database(): db.reset_db() pass
def init_database(): db.reset_db() pass
def setUp(self): db.reset_db()
def shutdown(self): ### ADD SHUTDOWN METHOD. self.srv.shutdown() def start_server(): def begin(server): run(server=server) server = TestWSGIServer(host=host, port=port) Thread(target=begin, args=(server, )).start() return server if __name__ == "__main__": timestamp = reset_db(blank=False) server = start_server() sleep(timeout) # give server time to start expected = "Berlin, 52.520007,13.404954\nBrasilia, -14.235004,-51.92528\nLondon, 51.507351,-0.127758\nMecca, 21.389082,39.857912\nMilano, 45.465422,9.185924\nSofia, 42.697708,23.321868" test_service(root_url + "/at", expected.upper()) expected = "42.697708,23.321868" test_service(root_url + "/at?name=sofia", expected) expected = "42.7,23.0" test_service(root_url + "/at?name=sofia&latitude=42.7&longitude=23", expected) test_service(root_url + "/at?name=sofia", expected) test_service(root_url + "/where") test_service(root_url + "/where/sofia", expected) test_service(root_url + "/where/sofia/42.697708/23.321868")
def setUp(self): reset_db()