explicitly set save_files = True in tests

This commit is contained in:
Lex Berezhny 2021-08-17 16:36:48 -04:00
parent 87094fc83f
commit f14010bd5b
2 changed files with 18 additions and 7 deletions

View file

@ -20,7 +20,7 @@ from lbry.dht.peer import PeerManager, make_kademlia_peer
def mock_config(): def mock_config():
config = Config() config = Config(save_files=True)
config.fixed_peer_delay = 10000 config.fixed_peer_delay = 10000
return config return config
@ -34,15 +34,25 @@ class BlobExchangeTestBase(AsyncioTestCase):
self.addCleanup(shutil.rmtree, self.client_wallet_dir) self.addCleanup(shutil.rmtree, self.client_wallet_dir)
self.addCleanup(shutil.rmtree, self.client_dir) self.addCleanup(shutil.rmtree, self.client_dir)
self.addCleanup(shutil.rmtree, self.server_dir) self.addCleanup(shutil.rmtree, self.server_dir)
self.server_config = Config(data_dir=self.server_dir, download_dir=self.server_dir, wallet=self.server_dir, self.server_config = Config(
fixed_peers=[]) data_dir=self.server_dir,
download_dir=self.server_dir,
wallet=self.server_dir,
save_files=True,
fixed_peers=[]
)
self.server_config.transaction_cache_size = 10000 self.server_config.transaction_cache_size = 10000
self.server_storage = SQLiteStorage(self.server_config, os.path.join(self.server_dir, "lbrynet.sqlite")) self.server_storage = SQLiteStorage(self.server_config, os.path.join(self.server_dir, "lbrynet.sqlite"))
self.server_blob_manager = BlobManager(self.loop, self.server_dir, self.server_storage, self.server_config) self.server_blob_manager = BlobManager(self.loop, self.server_dir, self.server_storage, self.server_config)
self.server = BlobServer(self.loop, self.server_blob_manager, 'bQEaw42GXsgCAGio1nxFncJSyRmnztSCjP') self.server = BlobServer(self.loop, self.server_blob_manager, 'bQEaw42GXsgCAGio1nxFncJSyRmnztSCjP')
self.client_config = Config(data_dir=self.client_dir, download_dir=self.client_dir, self.client_config = Config(
wallet=self.client_wallet_dir, fixed_peers=[]) data_dir=self.client_dir,
download_dir=self.client_dir,
wallet=self.client_wallet_dir,
save_files=True,
fixed_peers=[]
)
self.client_config.transaction_cache_size = 10000 self.client_config.transaction_cache_size = 10000
self.client_storage = SQLiteStorage(self.client_config, os.path.join(self.client_dir, "lbrynet.sqlite")) self.client_storage = SQLiteStorage(self.client_config, os.path.join(self.client_dir, "lbrynet.sqlite"))
self.client_blob_manager = BlobManager(self.loop, self.client_dir, self.client_storage, self.client_config) self.client_blob_manager = BlobManager(self.loop, self.client_dir, self.client_storage, self.client_config)
@ -101,7 +111,7 @@ class TestBlobExchange(BlobExchangeTestBase):
second_client_dir = tempfile.mkdtemp() second_client_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, second_client_dir) self.addCleanup(shutil.rmtree, second_client_dir)
second_client_conf = Config() second_client_conf = Config(save_files=True)
second_client_storage = SQLiteStorage(second_client_conf, os.path.join(second_client_dir, "lbrynet.sqlite")) second_client_storage = SQLiteStorage(second_client_conf, os.path.join(second_client_dir, "lbrynet.sqlite"))
second_client_blob_manager = BlobManager( second_client_blob_manager = BlobManager(
self.loop, second_client_dir, second_client_storage, second_client_conf self.loop, second_client_dir, second_client_storage, second_client_conf
@ -196,7 +206,7 @@ class TestBlobExchange(BlobExchangeTestBase):
second_client_dir = tempfile.mkdtemp() second_client_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, second_client_dir) self.addCleanup(shutil.rmtree, second_client_dir)
second_client_conf = Config() second_client_conf = Config(save_files=True)
second_client_storage = SQLiteStorage(second_client_conf, os.path.join(second_client_dir, "lbrynet.sqlite")) second_client_storage = SQLiteStorage(second_client_conf, os.path.join(second_client_dir, "lbrynet.sqlite"))
second_client_blob_manager = BlobManager( second_client_blob_manager = BlobManager(

View file

@ -105,6 +105,7 @@ async def get_mock_wallet(sd_hash, storage, wallet_dir, balance=10.0, fee=None):
wallet.generate_account(ledger) wallet.generate_account(ledger)
manager = WalletManager() manager = WalletManager()
manager.config = Config() manager.config = Config()
manager.config.save_files = True
manager.config.transaction_cache_size = 10000 manager.config.transaction_cache_size = 10000
manager.wallets.append(wallet) manager.wallets.append(wallet)
manager.ledgers[Ledger] = ledger manager.ledgers[Ledger] = ledger