commit 674bcc598afff7c7b1cfdc2f73bd862e5e319d19
parent 30c574a74ba1823c833a8d2a3fdec548bb8a59a9
Author: nolash <dev@holbrook.no>
Date: Tue, 19 Oct 2021 14:20:11 +0200
Remove urllib exception leak in chainlib, rehabilitate tests
Diffstat:
6 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/chainsyncer/driver/head.py b/chainsyncer/driver/head.py
@@ -6,6 +6,7 @@ from chainlib.eth.tx import (
transaction,
Tx,
)
+from chainlib.error import RPCException
# local imports
from chainsyncer.error import NoBlockForYou
diff --git a/requirements.txt b/requirements.txt
@@ -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
diff --git a/setup.cfg b/setup.cfg
@@ -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
diff --git a/tests/test_interrupt.py b/tests/test_interrupt.py
@@ -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
diff --git a/tests/test_mem.py b/tests/test_mem.py
@@ -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')
diff --git a/tests/test_thread_range.py b/tests/test_thread_range.py
@@ -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)