1
- import threading
2
1
import subprocess
2
+ import time
3
3
4
4
import pytest
5
- import time
6
5
7
6
from async_substrate_interface import AsyncSubstrateInterface , SubstrateInterface
7
+ from async_substrate_interface .errors import MaxRetriesExceeded , StateDiscardedError
8
8
from async_substrate_interface .substrate_addons import (
9
9
RetrySyncSubstrate ,
10
10
RetryAsyncSubstrate ,
11
11
)
12
- from async_substrate_interface .errors import MaxRetriesExceeded , StateDiscardedError
13
12
from tests .conftest import start_docker_container
14
13
15
14
LATENT_LITE_ENTRYPOINT = "wss://lite.sub.latent.to:443"
16
15
17
16
18
17
@pytest .fixture (scope = "function" )
19
18
def 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" ))
21
20
try :
22
21
yield processes
23
22
@@ -29,7 +28,7 @@ def docker_containers():
29
28
30
29
@pytest .fixture (scope = "function" )
31
30
def single_local_chain ():
32
- process = start_docker_container (9945 , 9945 )
31
+ process = start_docker_container (9945 , "9944" )
33
32
try :
34
33
yield process
35
34
finally :
@@ -72,30 +71,30 @@ def test_retry_sync_substrate_max_retries(docker_containers):
72
71
def test_retry_sync_substrate_offline ():
73
72
with pytest .raises (ConnectionError ):
74
73
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 " ]
76
75
)
77
76
78
77
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