def tearDown(self): yield self.uploader.stop() lbry_files = self.lbry_file_manager.lbry_files for lbry_file in lbry_files: yield self.lbry_file_manager.delete_lbry_file(lbry_file) yield self.lbry_file_manager.stop() yield self.blob_manager.stop() yield self.storage.stop() rm_db_and_blob_dir(self.db_dir, self.blob_dir) if os.path.exists("test_file"): os.remove("test_file")
def stop(self): lbry_files = self.lbry_file_manager.lbry_files for lbry_file in lbry_files: yield self.lbry_file_manager.delete_lbry_file(lbry_file) yield self.lbry_file_manager.stop() yield self.blob_manager.stop() yield self.storage.stop() self.server_port.stopListening() rm_db_and_blob_dir(self.db_dir, self.blob_dir) if os.path.exists("test_file"): os.remove("test_file")
def kill_server(): ds = [] ds.append(session.shut_down()) if server_port: ds.append(server_port.stopListening()) kill_check.stop() dead_event.set() dl = defer.DeferredList(ds) dl.addCallback(lambda _: reactor.stop()) dl.addCallback(lambda _: rm_db_and_blob_dir(db_dir, blob_dir)) return dl
def kill_server(self): session = self.session ds = [] ds.append(session.shut_down()) ds.append(self.lbry_file_manager.stop()) if self.server_port: ds.append(self.server_port.stopListening()) self.kill_check.stop() self.dead_event.set() dl = defer.DeferredList(ds) dl.addCallback(lambda _: rm_db_and_blob_dir(self.db_dir, self.blob_dir)) dl.addCallback(lambda _: self.reactor.stop()) return dl
def tearDown(self): lbry_files = self.client_lbry_file_manager.lbry_files for lbry_file in lbry_files: yield self.client_lbry_file_manager.delete_lbry_file(lbry_file) yield self.client_lbry_file_manager.stop() yield self.client_blob_manager.stop() yield self.client_storage.stop() self.reflector_port.stopListening() lbry_files = self.server_lbry_file_manager.lbry_files for lbry_file in lbry_files: yield self.server_lbry_file_manager.delete_lbry_file(lbry_file) yield self.server_lbry_file_manager.stop() yield self.server_blob_manager.stop() yield self.server_storage.stop() try: rm_db_and_blob_dir(self.client_db_dir, self.client_blob_dir) except Exception as err: raise unittest.SkipTest("TODO: fix this for windows") try: rm_db_and_blob_dir(self.server_db_dir, self.server_blob_dir) except Exception as err: raise unittest.SkipTest("TODO: fix this for windows") if os.path.exists("test_file"): os.remove("test_file")
def stop(arg): if isinstance(arg, Failure): logging.debug("Client is stopping due to an error. Error: %s", arg.getTraceback()) else: logging.debug("Client is stopping normally.") kill_event.set() logging.debug("Set the kill event") d = self.wait_for_event(dead_event, 15) def print_shutting_down(): logging.info("Client is shutting down") d.addCallback(lambda _: print_shutting_down()) d.addCallback(lambda _: rm_db_and_blob_dir(db_dir, blob_dir)) d.addCallback(lambda _: arg) return d
def tearDown(self): rm_db_and_blob_dir(self.db_dir, self.blob_dir)
def tearDown(self): yield self.blob_manager.stop() rm_db_and_blob_dir(self.tmp_db_dir, self.tmp_blob_dir)
def delete_test_env(): try: rm_db_and_blob_dir(self.db_dir, self.blob_dir) rm_db_and_blob_dir(self.server_db_dir, self.server_blob_dir) except: raise unittest.SkipTest("TODO: fix this for windows")
def tearDown(self): yield self.lbry_file_manager.stop() yield self.blob_manager.stop() yield self.storage.stop() rm_db_and_blob_dir(self.tmp_db_dir, self.tmp_blob_dir)