File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change 66import hivemind
77
88
9- async def ping_to_client (dht , node , peer_id : str ):
10- return await node .protocol .call_ping (hivemind . PeerID . from_base58 ( str ( peer_id )) )
9+ async def ping_to_client (dht , node , peer_id : hivemind . p2p . PeerID ):
10+ return await node .protocol .call_ping (peer_id )
1111
1212
1313@pytest .mark .forked
@@ -38,7 +38,6 @@ def test_autorelay(use_auto_relay: bool, use_relay: bool):
3838 client_mode = False ,
3939 use_auto_relay = use_auto_relay ,
4040 )
41- time .sleep (5 )
4241 dht_second_peer = hivemind .DHT (
4342 initial_peers = initial_peers ,
4443 start = True ,
@@ -50,15 +49,9 @@ def test_autorelay(use_auto_relay: bool, use_relay: bool):
5049
5150 assert dht_first_peer .is_alive () and dht_second_peer .is_alive () and dht_third_peer .is_alive ()
5251
53- time_start = time .perf_counter ()
54- while time .perf_counter () - time_start < 30 :
55- reached_ip = dht_second_peer .run_coroutine (partial (ping_to_client , peer_id = dht_third_peer .peer_id ))
56- if reached_ip :
57- assert use_relay
58- break
59- time .sleep (2 )
60- else :
61- assert not use_relay
52+ reached_ip = dht_second_peer .run_coroutine (partial (ping_to_client , peer_id = dht_third_peer .peer_id ))
53+ if reached_ip :
54+ assert use_relay
6255
6356 for peer in dht_first_peer , dht_second_peer , dht_third_peer :
6457 peer .shutdown ()
You can’t perform that action at this time.
0 commit comments