Skip to content

Commit a6c301a

Browse files
author
Roman
committed
temp run 2 tests for debug
1 parent 32c94a5 commit a6c301a

File tree

2 files changed

+41
-19
lines changed

2 files changed

+41
-19
lines changed

.github/workflows/e2e-subtensor-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ jobs:
4141
- name: Find test files
4242
id: get-tests
4343
run: |
44-
test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
44+
# test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
4545
# keep it here for future debug
46-
# test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(incentive|commit_weights|set_weights)\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))')
46+
test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(hotkeys|staking)\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))')
4747
echo "test-files=$test_files" >> "$GITHUB_OUTPUT"
4848
shell: bash
4949

tests/e2e_tests/test_hotkeys.py

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
import pytest
22

3-
import bittensor
3+
from bittensor.core.errors import (
4+
NotEnoughStakeToSetChildkeys,
5+
RegistrationNotPermittedOnRootSubnet,
6+
SubNetworkDoesNotExist,
7+
InvalidChild,
8+
TooManyChildren,
9+
ProportionOverflow,
10+
DuplicateChild,
11+
TxRateLimitExceeded,
12+
NonAssociatedColdKey,
13+
)
14+
from bittensor.utils.btlogging import logging
415
from tests.e2e_tests.utils.chain_interactions import (
516
sudo_set_admin_utils,
617
wait_epoch,
@@ -63,6 +74,7 @@ def test_hotkeys(subtensor, alice_wallet, dave_wallet):
6374
)
6475
is True
6576
)
77+
logging.console.success("Hotkey tests passed.")
6678

6779

6880
@pytest.mark.asyncio
@@ -97,7 +109,17 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
97109
is True
98110
)
99111

100-
with pytest.raises(bittensor.RegistrationNotPermittedOnRootSubnet):
112+
# assert (
113+
# sudo_set_admin_utils(
114+
# local_chain,
115+
# alice_wallet,
116+
# call_function="sudo_set_tx_rate_limit",
117+
# call_params={"tx_rate_limit": 100},
118+
# )[0]
119+
# is True
120+
# )
121+
122+
with pytest.raises(RegistrationNotPermittedOnRootSubnet):
101123
subtensor.set_children(
102124
alice_wallet,
103125
alice_wallet.hotkey.ss58_address,
@@ -106,7 +128,7 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
106128
raise_error=True,
107129
)
108130

109-
with pytest.raises(bittensor.NonAssociatedColdKey):
131+
with pytest.raises(NonAssociatedColdKey):
110132
subtensor.set_children(
111133
alice_wallet,
112134
alice_wallet.hotkey.ss58_address,
@@ -115,7 +137,7 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
115137
raise_error=True,
116138
)
117139

118-
with pytest.raises(bittensor.SubNetworkDoesNotExist):
140+
with pytest.raises(SubNetworkDoesNotExist):
119141
subtensor.set_children(
120142
alice_wallet,
121143
alice_wallet.hotkey.ss58_address,
@@ -128,10 +150,12 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
128150
alice_wallet,
129151
netuid=dave_subnet_netuid,
130152
)
153+
logging.console.success(f"Alice registered on subnet {dave_subnet_netuid}")
131154
subtensor.burned_register(
132155
bob_wallet,
133156
netuid=dave_subnet_netuid,
134157
)
158+
logging.console.success(f"Bob registered on subnet {dave_subnet_netuid}")
135159

136160
success, children, error = subtensor.get_children(
137161
alice_wallet.hotkey.ss58_address,
@@ -142,7 +166,7 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
142166
assert success is True
143167
assert children == []
144168

145-
with pytest.raises(bittensor.InvalidChild):
169+
with pytest.raises(InvalidChild):
146170
subtensor.set_children(
147171
alice_wallet,
148172
alice_wallet.hotkey.ss58_address,
@@ -156,7 +180,7 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
156180
raise_error=True,
157181
)
158182

159-
with pytest.raises(bittensor.TooManyChildren):
183+
with pytest.raises(TooManyChildren):
160184
subtensor.set_children(
161185
alice_wallet,
162186
alice_wallet.hotkey.ss58_address,
@@ -171,7 +195,7 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
171195
raise_error=True,
172196
)
173197

174-
with pytest.raises(bittensor.ProportionOverflow):
198+
with pytest.raises(ProportionOverflow):
175199
subtensor.set_children(
176200
alice_wallet,
177201
alice_wallet.hotkey.ss58_address,
@@ -189,7 +213,7 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
189213
raise_error=True,
190214
)
191215

192-
with pytest.raises(bittensor.DuplicateChild):
216+
with pytest.raises(DuplicateChild):
193217
subtensor.set_children(
194218
alice_wallet,
195219
alice_wallet.hotkey.ss58_address,
@@ -242,13 +266,8 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
242266
netuid=dave_subnet_netuid,
243267
)
244268

245-
assert pending == [
246-
(
247-
1.0,
248-
"5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
249-
),
250-
]
251-
bittensor.logging.console.info(f"cooldown: {cooldown}")
269+
assert pending == [(1.0, bob_wallet.hotkey.ss58_address)]
270+
logging.console.info(f"Cooldown 1 is: {cooldown}")
252271

253272
subtensor.wait_for_block(cooldown)
254273

@@ -276,7 +295,7 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
276295

277296
assert pending == []
278297

279-
with pytest.raises(bittensor.TxRateLimitExceeded):
298+
with pytest.raises(TxRateLimitExceeded):
280299
subtensor.set_children(
281300
alice_wallet,
282301
alice_wallet.hotkey.ss58_address,
@@ -301,6 +320,8 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
301320
netuid=dave_subnet_netuid,
302321
)
303322

323+
logging.console.info(f"Cooldown 2 is: {cooldown}")
324+
304325
assert pending == []
305326

306327
subtensor.wait_for_block(cooldown)
@@ -325,7 +346,7 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
325346
},
326347
)
327348

328-
with pytest.raises(bittensor.NotEnoughStakeToSetChildkeys):
349+
with pytest.raises(NotEnoughStakeToSetChildkeys):
329350
subtensor.set_children(
330351
alice_wallet,
331352
alice_wallet.hotkey.ss58_address,
@@ -338,3 +359,4 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
338359
],
339360
raise_error=True,
340361
)
362+
logging.console.success("[green]test_children[/green] passed.")

0 commit comments

Comments
 (0)