Skip to content

Commit c2e289d

Browse files
committed
Added prints to the tests
1 parent 19eea27 commit c2e289d

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

tests/integration_tests/test_async_substrate_interface.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
@pytest.mark.asyncio
1818
async def test_legacy_decoding():
19+
print("Testing test_legacy_decoding")
1920
# roughly 4000 blocks before metadata v15 was added
2021
pre_metadata_v15_block = 3_010_611
2122

@@ -39,10 +40,12 @@ async def test_legacy_decoding():
3940
block_hash=block_hash,
4041
)
4142
assert timestamp.value == 1716358476004
43+
print("test_legacy_decoding succeeded")
4244

4345

4446
@pytest.mark.asyncio
4547
async def test_ss58_conversion():
48+
print("Testing test_ss58_conversion")
4649
async with AsyncSubstrateInterface(
4750
LATENT_LITE_ENTRYPOINT, ss58_format=42, decode_ss58=False
4851
) as substrate:
@@ -79,10 +82,12 @@ async def test_ss58_conversion():
7982
if len(value.value) > 0:
8083
for decoded_key in value.value:
8184
assert isinstance(decoded_key, str)
85+
print("test_ss58_conversion succeeded")
8286

8387

8488
@pytest.mark.asyncio
8589
async def test_fully_exhaust_query_map():
90+
print("Testing test_fully_exhaust_query_map")
8691
async with AsyncSubstrateInterface(LATENT_LITE_ENTRYPOINT) as substrate:
8792
block_hash = await substrate.get_chain_finalised_head()
8893
non_fully_exhauster_start = time.time()
@@ -121,10 +126,12 @@ async def test_fully_exhaust_query_map():
121126
fully_exhausted_records_count += 1
122127
assert fully_exhausted_records_count == initial_records_count_fully_exhaust
123128
assert initial_records_count_fully_exhaust == exhausted_records_count
129+
print("test_fully_exhaust_query_map succeeded")
124130

125131

126132
@pytest.mark.asyncio
127133
async def test_get_events_proper_decoding():
134+
print("Testing test_get_events_proper_decoding")
128135
# known block/hash pair that has the events we seek to decode
129136
block = 5846788
130137
block_hash = "0x0a1c45063a59b934bfee827caa25385e60d5ec1fd8566a58b5cc4affc4eec412"
@@ -137,10 +144,12 @@ async def test_get_events_proper_decoding():
137144
30,
138145
"0xa6b4e5c8241d60ece0c25056b19f7d21ae845269fc771ad46bf3e011865129a5",
139146
)
147+
print("test_get_events_proper_decoding succeeded")
140148

141149

142150
@pytest.mark.asyncio
143151
async def test_query_multiple():
152+
print("Testing test_query_multiple")
144153
block = 6153277
145154
cks = [
146155
"5FH9AQM4kqbkdC9jyV5FrdEWVYt41nkhFstop7Vhyfb9ZsXt",
@@ -155,21 +164,25 @@ async def test_query_multiple():
155164
storage_function="OwnedHotkeys",
156165
block_hash=block_hash,
157166
)
167+
print("test_query_multiple succeeded")
158168

159169

160170
@pytest.mark.asyncio
161171
async def test_reconnection():
172+
print("Testing test_reconnection")
162173
async with AsyncSubstrateInterface(
163174
ARCHIVE_ENTRYPOINT, ss58_format=42, retry_timeout=8.0
164175
) as substrate:
165176
await asyncio.sleep(9) # sleep for longer than the retry timeout
166177
bh = await substrate.get_chain_finalised_head()
167178
assert isinstance(bh, str)
168179
assert isinstance(await substrate.get_block_number(bh), int)
180+
print("test_reconnection succeeded")
169181

170182

171183
@pytest.mark.asyncio
172184
async def test_query_map_with_odd_number_of_params():
185+
print("Testing test_query_map_with_odd_number_of_params")
173186
async with AsyncSubstrateInterface(ARCHIVE_ENTRYPOINT, ss58_format=42) as substrate:
174187
qm = await substrate.query_map(
175188
"SubtensorModule",
@@ -179,10 +192,12 @@ async def test_query_map_with_odd_number_of_params():
179192
first_record = qm.records[0]
180193
assert len(first_record) == 2
181194
assert len(first_record[0]) == 4
195+
print("test_query_map_with_odd_number_of_params succeeded")
182196

183197

184198
@pytest.mark.asyncio
185199
async def test_improved_reconnection():
200+
print("Testing test_improved_reconnection")
186201
ws_logger_path = "/tmp/websockets-proxy-test"
187202
ws_logger = logging.getLogger("websockets.proxy")
188203
if os.path.exists(ws_logger_path):
@@ -236,10 +251,12 @@ async def test_improved_reconnection():
236251
shutdown_thread.start()
237252
shutdown_thread.join(timeout=5)
238253
server_thread.join(timeout=5)
254+
print("test_improved_reconnection succeeded")
239255

240256

241257
@pytest.mark.asyncio
242258
async def test_get_payment_info():
259+
print("Testing test_get_payment_info")
243260
alice_coldkey = bittensor_wallet.Keypair.create_from_uri("//Alice")
244261
bob_coldkey = bittensor_wallet.Keypair.create_from_uri("//Bob")
245262
async with AsyncSubstrateInterface(
@@ -275,3 +292,4 @@ async def test_get_payment_info():
275292
partial_fee_all_options = payment_info_all_options["partial_fee"]
276293
assert partial_fee_all_options > partial_fee_no_era
277294
assert partial_fee_all_options > partial_fee_era
295+
print("test_get_payment_info succeeded")

tests/integration_tests/test_disk_cache.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
@pytest.mark.asyncio
1111
async def test_disk_cache():
12+
print("Testing test_disk_cache")
1213
entrypoint = "wss://entrypoint-finney.opentensor.ai:443"
1314
async with DiskCachedAsyncSubstrateInterface(entrypoint) as disk_cached_substrate:
1415
current_block = await disk_cached_substrate.get_block_number(None)
@@ -72,3 +73,4 @@ async def test_disk_cache():
7273
assert parent_block_hash == parent_block_hash_sync
7374
assert block_runtime_info == block_runtime_info_sync
7475
assert block_runtime_version_for == block_runtime_version_for_sync
76+
print("test_disk_cache succeeded")

tests/integration_tests/test_substrate_interface.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
def test_legacy_decoding():
10+
print("Testing test_legacy_decoding")
1011
# roughly 4000 blocks before metadata v15 was added
1112
pre_metadata_v15_block = 3_010_611
1213

@@ -30,9 +31,11 @@ def test_legacy_decoding():
3031
block_hash=block_hash,
3132
)
3233
assert timestamp.value == 1716358476004
34+
print("test_legacy_decoding succeeded")
3335

3436

3537
def test_ss58_conversion():
38+
print("Testing test_ss58_conversion")
3639
with SubstrateInterface(
3740
LATENT_LITE_ENTRYPOINT, ss58_format=42, decode_ss58=False
3841
) as substrate:
@@ -69,9 +72,11 @@ def test_ss58_conversion():
6972
if len(value.value) > 0:
7073
for decoded_key in value.value:
7174
assert isinstance(decoded_key, str)
75+
print("test_ss58_conversion succeeded")
7276

7377

7478
def test_get_events_proper_decoding():
79+
print("Testing test_get_events_proper_decoding")
7580
# known block/hash pair that has the events we seek to decode
7681
block = 5846788
7782
block_hash = "0x0a1c45063a59b934bfee827caa25385e60d5ec1fd8566a58b5cc4affc4eec412"
@@ -84,9 +89,11 @@ def test_get_events_proper_decoding():
8489
30,
8590
"0xa6b4e5c8241d60ece0c25056b19f7d21ae845269fc771ad46bf3e011865129a5",
8691
)
92+
print("test_get_events_proper_decoding succeeded")
8793

8894

8995
def test_query_multiple():
96+
print("Testing test_query_multiple")
9097
block = 6153277
9198
cks = [
9299
"5FH9AQM4kqbkdC9jyV5FrdEWVYt41nkhFstop7Vhyfb9ZsXt",
@@ -101,9 +108,11 @@ def test_query_multiple():
101108
storage_function="OwnedHotkeys",
102109
block_hash=block_hash,
103110
)
111+
print("test_query_multiple succeeded")
104112

105113

106114
def test_query_map_with_odd_number_of_params():
115+
print("Testing test_query_map_with_odd_number_of_params")
107116
with SubstrateInterface(LATENT_LITE_ENTRYPOINT, ss58_format=42) as substrate:
108117
qm = substrate.query_map(
109118
"SubtensorModule",
@@ -113,9 +122,11 @@ def test_query_map_with_odd_number_of_params():
113122
first_record = qm.records[0]
114123
assert len(first_record) == 2
115124
assert len(first_record[0]) == 4
125+
print("test_query_map_with_odd_number_of_params succeeded")
116126

117127

118128
def test_get_payment_info():
129+
print("Testing test_get_payment_info")
119130
alice_coldkey = bittensor_wallet.Keypair.create_from_uri("//Alice")
120131
bob_coldkey = bittensor_wallet.Keypair.create_from_uri("//Bob")
121132
with SubstrateInterface(
@@ -151,3 +162,4 @@ def test_get_payment_info():
151162
partial_fee_all_options = payment_info_all_options["partial_fee"]
152163
assert partial_fee_all_options > partial_fee_no_era
153164
assert partial_fee_all_options > partial_fee_era
165+
print("test_get_payment_info succeeded")

tests/unit_tests/asyncio_/test_substrate_interface.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@
1313
@pytest.mark.asyncio
1414
async def test_invalid_url_raises_exception():
1515
"""Test that invalid URI raises an InvalidURI exception."""
16+
print("Testing test_invalid_url_raises_exception")
1617
async_substrate = AsyncSubstrateInterface("non_existent_entry_point")
1718
with pytest.raises(InvalidURI):
1819
await async_substrate.initialize()
1920

2021
with pytest.raises(InvalidURI):
2122
async with AsyncSubstrateInterface(
2223
"non_existent_entry_point"
23-
) as async_substrate:
24+
) as _:
2425
pass
26+
print("test_invalid_url_raises_exception succeeded")
2527

2628

2729
@pytest.mark.asyncio
2830
async def test_runtime_call(monkeypatch):
31+
print("Testing test_runtime_call")
2932
substrate = AsyncSubstrateInterface("ws://localhost", _mock=True)
3033

3134
fake_runtime = MagicMock()
@@ -96,10 +99,12 @@ async def test_runtime_call(monkeypatch):
9699
substrate.rpc_request.assert_any_call(
97100
"state_call", ["SubstrateApi_SubstrateMethod", "", None], runtime=ANY
98101
)
102+
print("test_runtime_call succeeded")
99103

100104

101105
@pytest.mark.asyncio
102106
async def test_websocket_shutdown_timer():
107+
print("Testing test_websocket_shutdown_timer")
103108
# using default ws shutdown timer of 5.0 seconds
104109
async with AsyncSubstrateInterface("wss://lite.sub.latent.to:443") as substrate:
105110
await substrate.get_chain_head()
@@ -115,10 +120,12 @@ async def test_websocket_shutdown_timer():
115120
await substrate.get_chain_head()
116121
await asyncio.sleep(6) # same sleep time as before
117122
assert substrate.ws.state is State.OPEN # connection should still be open
123+
print("test_websocket_shutdown_timer succeeded")
118124

119125

120126
@pytest.mark.asyncio
121127
async def test_runtime_switching():
128+
print("Testing test_runtime_switching")
122129
block = 6067945 # block where a runtime switch happens
123130
async with AsyncSubstrateInterface(
124131
ARCHIVE_ENTRYPOINT, ss58_format=42, chain_name="Bittensor"
@@ -133,3 +140,4 @@ async def test_runtime_switching():
133140
)
134141
assert one is not None
135142
assert two is not None
143+
print("test_runtime_switching succeeded")

tests/unit_tests/sync/test_substrate_interface.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
def test_runtime_call(monkeypatch):
10+
print("Testing test_runtime_call")
1011
substrate = SubstrateInterface("ws://localhost", _mock=True)
1112
fake_runtime = MagicMock()
1213
fake_metadata_v15 = MagicMock()
@@ -75,9 +76,11 @@ def test_runtime_call(monkeypatch):
7576
"state_call", ["SubstrateApi_SubstrateMethod", "", None]
7677
)
7778
substrate.close()
79+
print("test_runtime_call succeeded")
7880

7981

8082
def test_runtime_switching():
83+
print("Testing test_runtime_switching")
8184
block = 6067945 # block where a runtime switch happens
8285
with SubstrateInterface(
8386
ARCHIVE_ENTRYPOINT, ss58_format=42, chain_name="Bittensor"
@@ -86,3 +89,4 @@ def test_runtime_switching():
8689
assert substrate.get_extrinsics(block_number=block - 20) is not None
8790
assert substrate.get_extrinsics(block_number=block) is not None
8891
assert substrate.get_extrinsics(block_number=block - 21) is not None
92+
print("test_runtime_switching succeeded")

0 commit comments

Comments
 (0)