class TestSuiteRunner(DjangoTestSuiteRunner): def setup_test_environment(self): self.bail = threading.Event() self.database_thread = DatabaseThread(self.bail) self.database_thread.start() super(TestSuiteRunner, self).setup_test_environment() def teardown_test_environment(self): super(TestSuiteRunner, self).teardown_test_environment() self.bail.set() self.database_thread.join() shutil.rmtree(settings.TIME_SERIES_PATH)
def handle(self, addrport='', **options): if not os.path.exists(settings.DATA_DIR): os.makedirs(settings.DATA_DIR) logging.basicConfig(stream=sys.stderr, level=logging.INFO) call_command('syncdb') call_command('collectstatic', interactive=False, link=True) bail = threading.Event() database_thread = DatabaseThread(bail) database_thread.start() try: time.sleep(1) self.load_demo_data() call_command('runserver', use_reloader=False) except BaseException: traceback.print_exc() bail.set() database_thread.join()