Skip to content

Commit 46aedc1

Browse files
author
Roman
committed
add e2e tests helper
1 parent 14f6033 commit 46aedc1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/e2e_tests/utils/e2e_test_utils.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,42 @@ def miner(self, wallet, netuid):
226226

227227
def validator(self, wallet, netuid):
228228
return self.Validator(self.dir, wallet, netuid)
229+
230+
231+
def wait_to_start_call(
232+
subtensor: "bittensor.Subtensor",
233+
subnet_owner_wallet: "bittensor.Wallet",
234+
netuid: int,
235+
in_blocks: int = 10,
236+
):
237+
"""Waits for a certain number of blocks before making a start call."""
238+
# make sure we passed start_call limit
239+
subtensor.wait_for_block(subtensor.block + in_blocks + 1)
240+
status, message = subtensor.start_call(
241+
wallet=subnet_owner_wallet,
242+
netuid=netuid,
243+
wait_for_inclusion=True,
244+
wait_for_finalization=True,
245+
)
246+
assert status, message
247+
return True
248+
249+
250+
async def async_wait_to_start_call(
251+
subtensor: "bittensor.AsyncSubtensor",
252+
subnet_owner_wallet: "bittensor.Wallet",
253+
netuid: int,
254+
in_blocks: int = 10,
255+
):
256+
"""Waits for a certain number of blocks before making a start call."""
257+
# make sure we passed start_call limit
258+
current_block = await subtensor.block
259+
await subtensor.wait_for_block(current_block + in_blocks + 1)
260+
status, message = await subtensor.start_call(
261+
wallet=subnet_owner_wallet,
262+
netuid=netuid,
263+
wait_for_inclusion=True,
264+
wait_for_finalization=True,
265+
)
266+
assert status, message
267+
return True

0 commit comments

Comments
 (0)