cleanup parameters #51
GitHub Actions / Test Results
failed
Feb 4, 2024 in 0s
1 fail, 11 skipped, 1β077 pass in 1m 7s
Annotations
Check warning on line 0 in tests.sandbox_tests.test_concurrent.ConcurrentTransactionsTestCase
github-actions / Test Results
test_1_originate_contract (tests.sandbox_tests.test_concurrent.ConcurrentTransactionsTestCase) failed
sandbox_test_results.xmlβ[took 11s]
Raw output
TimeoutError: [Errno Reached timeout (%d sec) while waiting for the next block] 5
self = <test_concurrent.ConcurrentTransactionsTestCase testMethod=test_1_originate_contract>
def test_1_originate_contract(self) -> None:
ci = ContractInterface.from_michelson(code)
res = (
self.client.origination(ci.script())
.autofill()
.sign()
> .inject(
time_between_blocks=self.TIME_BETWEEN_BLOCKS,
min_confirmations=1,
block_timeout=5,
)
)
tests/sandbox_tests/test_concurrent.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pytezos/jupyter.py:90: in __call__
return method(self.obj, *args, **kwargs)
src/pytezos/operation/group.py:444: in inject
operations = self.shell.wait_operations(
src/pytezos/jupyter.py:90: in __call__
return method(self.obj, *args, **kwargs)
src/pytezos/rpc/shell.py:164: in wait_operations
for block_hash in self.wait_blocks( # noqa: B020
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pytezos.rpc.shell.ShellQuery object at 0x7f0e2b873c10>
Properties
.path /
.node ['http://localhost:8732']
RPC endpo...ls
.stats
.version
.workers
Helpers
.block()
.get_confirmations()
.wait_blocks()
.wait_next_block()
.wait_operations()
current_block_hash = 'BKr4J1zypxB3ZwzgAj7RVLSS7Q6gdLrLLP3ktxWZSd9SPEg13gU'
max_blocks = 5, yield_current = True, time_between_blocks = 3, block_timeout = 5
def wait_blocks(
self,
current_block_hash: str,
max_blocks: int = 1,
yield_current=False,
time_between_blocks: Optional[int] = None,
block_timeout: Optional[int] = None,
) -> Generator[str, None, None]:
"""Iterates over future blocks (waits and yields block hash), handles reorgs
:param current_block_hash: hash of the current block (head)
:param max_blocks: number of blocks to iterate (not including the current one)
:param yield_current: yield current block hash at the very beginning
:param time_between_blocks: override protocol constant
:param block_timeout: set block timeout (by default Pytezos will wait for a long time)
:return: block hashes
"""
if time_between_blocks is None:
constants = self.blocks[current_block_hash].context.constants()
time_between_blocks = int(constants.get('minimal_block_delay', 0))
if block_timeout is None:
block_timeout = MAX_BLOCK_TIMEOUT
if yield_current:
yield current_block_hash
current_header = self.blocks[current_block_hash].header()
max_level = current_header['level'] + max_blocks
while current_header['level'] < max_level:
logger.info('Current level: %d (max %d)', current_header['level'], max_level)
prev_block_dt = datetime.strptime(current_header['timestamp'], '%Y-%m-%dT%H:%M:%SZ')
elapsed_sec = (datetime.utcnow() - prev_block_dt).seconds
sleep_sec = 1 if elapsed_sec > time_between_blocks else (time_between_blocks - elapsed_sec + 1)
logger.info('Sleep %d seconds until block %s is superseded', sleep_sec, current_block_hash)
sleep(sleep_sec)
next_block_hash: Optional[str] = None
for delay in range(block_timeout):
next_block_hash = self.head.hash()
if current_block_hash == next_block_hash:
sleep(1)
else:
logger.info('Found new block %s (%d sec delay)', next_block_hash, delay)
break
if current_block_hash != next_block_hash:
assert next_block_hash
yield next_block_hash
current_block_hash = next_block_hash
current_header = self.blocks[current_block_hash].header()
else:
> raise TimeoutError('Reached timeout (%d sec) while waiting for the next block', block_timeout)
E TimeoutError: [Errno Reached timeout (%d sec) while waiting for the next block] 5
src/pytezos/rpc/shell.py:134: TimeoutError
Loading