Fix tests

This commit is contained in:
Evgeny Medvedev
2019-03-28 01:12:52 +07:00
parent edc3211544
commit 47bd5957d4
2 changed files with 7 additions and 3 deletions

View File

@@ -55,7 +55,8 @@ class Streamer:
batch_size=100,
block_batch_size=10,
max_workers=5,
entity_types=tuple(EntityType.ALL_FOR_STREAMING)):
entity_types=tuple(EntityType.ALL_FOR_STREAMING),
retry_errors=True):
self.batch_web3_provider = batch_web3_provider
self.last_synced_block_file = last_synced_block_file
self.lag = lag
@@ -67,6 +68,7 @@ class Streamer:
self.block_batch_size = block_batch_size
self.max_workers = max_workers
self.entity_types = entity_types
self.retry_errors = retry_errors
def stream(self):
if self.start_block is not None or not os.path.isfile(self.last_synced_block_file):
@@ -84,6 +86,8 @@ class Streamer:
except Exception as e:
# https://stackoverflow.com/a/4992124/1580227
logging.exception('An exception occurred while fetching block data.')
if not self.retry_errors:
raise e
synced_blocks = new_last_synced_block - last_synced_block
last_synced_block = new_last_synced_block

View File

@@ -39,7 +39,6 @@ def read_resource(resource_group, file_name):
return tests.resources.read_resource([RESOURCE_GROUP, resource_group], file_name)
@pytest.mark.timeout(10)
@pytest.mark.parametrize("start_block, end_block, batch_size, resource_group, entity_types, provider_type", [
(1755634, 1755635, 1, 'blocks_1755634_1755635', EntityType.ALL_FOR_INFURA, 'mock'),
skip_if_slow_tests_disabled([1755634, 1755635, 1, 'blocks_1755634_1755635', EntityType.ALL_FOR_INFURA, 'infura']),
@@ -79,7 +78,8 @@ def test_stream(tmpdir, start_block, end_block, batch_size, resource_group, enti
'token': tokens_output_file,
}
),
entity_types=entity_types
entity_types=entity_types,
retry_errors=False
)
streamer.stream()