Remove urllib exception leak in chainlib, rehabilitate tests

This commit is contained in:
nolash 2021-10-19 14:20:11 +02:00
parent 30c574a74b
commit 674bcc598a
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
6 changed files with 13 additions and 7 deletions

View File

@ -6,6 +6,7 @@ from chainlib.eth.tx import (
transaction,
Tx,
)
from chainlib.error import RPCException
# local imports
from chainsyncer.error import NoBlockForYou

View File

@ -1,4 +1,4 @@
confini>=0.3.6rc3,<0.5.0
semver==2.13.0
hexathon~=0.0.1a8
chainlib>=0.0.9a11,<=0.1.0
chainlib>=0.0.10a4,<=0.1.0

View File

@ -1,6 +1,6 @@
[metadata]
name = chainsyncer
version = 0.0.7a1
version = 0.0.7a3
description = Generic blockchain syncer driver
author = Louis Holbrook
author_email = dev@holbrook.no

View File

@ -122,7 +122,7 @@ class TestInterrupt(TestBase):
def test_filter_interrupt_memory(self):
self.track_complete = True
for vector in self.vectors:
self.backend = MemBackend(self.chain_spec, None, target_block=len(vector))
self.backend = MemBackend.custom(self.chain_spec, target_block=len(vector))
self.assert_filter_interrupt(vector, self.interface)
#TODO: implement flag lock in file backend

View File

@ -1,5 +1,6 @@
# standard imports
import unittest
import logging
# external imports
from chainlib.chain import ChainSpec
@ -10,18 +11,20 @@ from chainsyncer.backend.memory import MemBackend
# testutil imports
from tests.chainsyncer_base import TestBase
logging.basicConfig(level=logging.DEBUG)
class TestMem(TestBase):
def test_backend_mem_custom(self):
chain_spec = ChainSpec('evm', 'bloxberg', 8996, 'foo')
flags = int(5).to_bytes(2, 'big')
#flags_target = int(1024-1).to_bytes(2, 'big')
flag_count = 10
flags_target = (2 ** 10) - 1
backend = MemBackend.custom(chain_spec, 666, 42, 2, flags, flag_count, object_id='xyzzy')
self.assertEqual(((42, 2), flags), backend.start())
self.assertEqual(((42, 2), flags), backend.get())
self.assertEqual((666, flags), backend.target())
self.assertEqual((666, flags_target), backend.target())
self.assertEqual(backend.object_id, 'xyzzy')

View File

@ -77,9 +77,11 @@ class TestThreadRange(TestBaseEth):
def test_range_syncer_hello(self):
chain_spec = ChainSpec('evm', 'bloxberg', 8996, 'foo')
#chain_spec = ChainSpec('evm', 'bloxberg', 8996, 'foo')
chain_spec = ChainSpec('evm', 'foochain', 42)
backend = MemBackend.custom(chain_spec, 20, 5, 3, 5, 10)
syncer = ThreadPoolRangeHistorySyncer(MockConn, 3, backend, self.interface)
#syncer = ThreadPoolRangeHistorySyncer(MockConn, 3, backend, self.interface)
syncer = ThreadPoolRangeHistorySyncer(3, backend, self.interface)
syncer.loop(0.1, None)