Skip to content

Commit 5804210

Browse files
Merge pull request #2703 from opentensor/tests/zyzniewski/fix_e2e_test_set_weights
Fix E2E test_set_weights
2 parents 380c5a3 + cea1b70 commit 5804210

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

tests/e2e_tests/test_set_weights.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import numpy as np
22
import pytest
33

4-
import asyncio
5-
64
from bittensor.utils.balance import Balance
75
from bittensor.utils.weight_utils import convert_weights_and_uids_for_emit
86
from tests.e2e_tests.utils.chain_interactions import (
97
sudo_set_hyperparameter_bool,
108
sudo_set_hyperparameter_values,
119
sudo_set_admin_utils,
10+
wait_epoch,
1211
)
1312

1413

@@ -120,7 +119,7 @@ async def test_set_weights_uses_next_nonce(local_chain, subtensor, alice_wallet)
120119
assert success is True, f"Failed to set weights for subnet {netuid}"
121120

122121
# Wait for the txs to be included in the chain
123-
await asyncio.sleep(4)
122+
await wait_epoch(subtensor, netuid=netuids[-1], times=4)
124123

125124
for netuid in netuids:
126125
# Query the Weights storage map for all three subnets

tests/e2e_tests/utils/chain_interactions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def sudo_set_hyperparameter_values(
6767
return response.is_success
6868

6969

70-
async def wait_epoch(subtensor: "Subtensor", netuid: int = 1):
70+
async def wait_epoch(subtensor: "Subtensor", netuid: int = 1, times: int = 1):
7171
"""
7272
Waits for the next epoch to start on a specific subnet.
7373
@@ -83,7 +83,7 @@ async def wait_epoch(subtensor: "Subtensor", netuid: int = 1):
8383
raise Exception("could not determine tempo")
8484
tempo = q_tempo[0].value
8585
logging.info(f"tempo = {tempo}")
86-
await wait_interval(tempo, subtensor, netuid)
86+
await wait_interval(tempo * times, subtensor, netuid)
8787

8888

8989
def next_tempo(current_block: int, tempo: int, netuid: int) -> int:

0 commit comments

Comments
 (0)