1- import threading
21import subprocess
2+ import time
33
44import pytest
5- import time
65
76from async_substrate_interface import AsyncSubstrateInterface , SubstrateInterface
7+ from async_substrate_interface .errors import MaxRetriesExceeded , StateDiscardedError
88from async_substrate_interface .substrate_addons import (
99 RetrySyncSubstrate ,
1010 RetryAsyncSubstrate ,
1111)
12- from async_substrate_interface .errors import MaxRetriesExceeded , StateDiscardedError
1312from tests .conftest import start_docker_container
1413
1514LATENT_LITE_ENTRYPOINT = "wss://lite.sub.latent.to:443"
1615
1716
1817@pytest .fixture (scope = "function" )
1918def docker_containers ():
20- processes = (start_docker_container (9945 , 9945 ), start_docker_container (9946 , 9946 ))
19+ processes = (start_docker_container (9944 , "9944" ), start_docker_container (9945 , "9945" ))
2120 try :
2221 yield processes
2322
@@ -29,7 +28,7 @@ def docker_containers():
2928
3029@pytest .fixture (scope = "function" )
3130def single_local_chain ():
32- process = start_docker_container (9945 , 9945 )
31+ process = start_docker_container (9945 , "9944" )
3332 try :
3433 yield process
3534 finally :
@@ -72,30 +71,30 @@ def test_retry_sync_substrate_max_retries(docker_containers):
7271def test_retry_sync_substrate_offline ():
7372 with pytest .raises (ConnectionError ):
7473 RetrySyncSubstrate (
75- "ws://127.0.0.1:9945 " , fallback_chains = ["ws://127.0.0.1:9946 " ]
74+ "ws://127.0.0.1:9944 " , fallback_chains = ["ws://127.0.0.1:9945 " ]
7675 )
7776
7877
79- @pytest .mark .asyncio
80- async def test_retry_async_subtensor_archive_node ():
81- async with AsyncSubstrateInterface ("wss://lite.sub.latent.to:443" ) as substrate :
82- current_block = await substrate .get_block_number ()
83- old_block = current_block - 1000
84- with pytest .raises (StateDiscardedError ):
85- await substrate .get_block (block_number = old_block )
86- async with RetryAsyncSubstrate (
87- "wss://lite.sub.latent.to:443" , archive_nodes = ["ws://178.156.172.75:9944" ]
88- ) as substrate :
89- assert isinstance ((await substrate .get_block (block_number = old_block )), dict )
90-
91-
92- def test_retry_sync_subtensor_archive_node ():
93- with SubstrateInterface ("wss://lite.sub.latent.to:443" ) as substrate :
94- current_block = substrate .get_block_number ()
95- old_block = current_block - 1000
96- with pytest .raises (StateDiscardedError ):
97- substrate .get_block (block_number = old_block )
98- with RetrySyncSubstrate (
99- "wss://lite.sub.latent.to:443" , archive_nodes = ["ws://178.156.172.75:9944" ]
100- ) as substrate :
101- assert isinstance ((substrate .get_block (block_number = old_block )), dict )
78+ # @pytest.mark.asyncio
79+ # async def test_retry_async_subtensor_archive_node():
80+ # async with AsyncSubstrateInterface("wss://lite.sub.latent.to:443") as substrate:
81+ # current_block = await substrate.get_block_number()
82+ # old_block = current_block - 1000
83+ # with pytest.raises(StateDiscardedError):
84+ # await substrate.get_block(block_number=old_block)
85+ # async with RetryAsyncSubstrate(
86+ # "wss://lite.sub.latent.to:443", archive_nodes=[LATENT_LITE_ENTRYPOINT ]
87+ # ) as substrate:
88+ # assert isinstance((await substrate.get_block(block_number=old_block)), dict)
89+ #
90+ #
91+ # def test_retry_sync_subtensor_archive_node():
92+ # with SubstrateInterface("wss://lite.sub.latent.to:443") as substrate:
93+ # current_block = substrate.get_block_number()
94+ # old_block = current_block - 1000
95+ # with pytest.raises(StateDiscardedError):
96+ # substrate.get_block(block_number=old_block)
97+ # with RetrySyncSubstrate(
98+ # "wss://lite.sub.latent.to:443", archive_nodes=[LATENT_LITE_ENTRYPOINT ]
99+ # ) as substrate:
100+ # assert isinstance((substrate.get_block(block_number=old_block)), dict)
0 commit comments