Skip to content

Commit d8112fb

Browse files
committed
fix: updated AsyncClient tests to try to avoid tests hanging when executed in Windows machines
1 parent 9ef69b1 commit d8112fb

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

tests/test_async_client.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pyinjective.proto.injective.exchange.v2 import query_pb2 as exchange_query_pb
1010
from tests.client.chain.grpc.configurable_bank_query_servicer import ConfigurableBankQueryServicer
1111
from tests.client.chain.grpc.configurable_exchange_v2_query_servicer import ConfigurableExchangeV2QueryServicer
12+
from tests.core.tendermint.grpc.configurable_tendermint_query_servicer import ConfigurableTendermintQueryServicer
1213
from tests.rpc_fixtures.markets_fixtures import ( # noqa: F401
1314
ape_token_meta,
1415
ape_usdt_spot_market_meta,
@@ -33,13 +34,20 @@ def exchange_servicer():
3334
return ConfigurableExchangeV2QueryServicer()
3435

3536

37+
@pytest.fixture
38+
def tendermint_servicer():
39+
return ConfigurableTendermintQueryServicer()
40+
41+
3642
class TestAsyncClient:
3743
@pytest.mark.asyncio
38-
async def test_sync_timeout_height_logs_exception(self, caplog):
44+
async def test_sync_timeout_height_logs_exception(self, caplog, tendermint_servicer):
3945
client = AsyncClient(
4046
network=Network.local(),
4147
)
4248

49+
client.tendermint_api._stub = tendermint_servicer
50+
4351
with caplog.at_level(logging.DEBUG):
4452
await client.sync_timeout_height()
4553

@@ -53,11 +61,13 @@ async def test_sync_timeout_height_logs_exception(self, caplog):
5361
assert found_log[1] == logging.DEBUG
5462

5563
@pytest.mark.asyncio
56-
async def test_get_account_logs_exception(self, caplog):
64+
async def test_get_account_logs_exception(self, caplog, tendermint_servicer):
5765
client = AsyncClient(
5866
network=Network.local(),
5967
)
6068

69+
client.tendermint_api._stub = tendermint_servicer
70+
6171
with caplog.at_level(logging.DEBUG):
6272
await client.fetch_account(address="")
6373

@@ -74,6 +84,7 @@ async def test_get_account_logs_exception(self, caplog):
7484
async def test_initialize_tokens_and_markets(
7585
self,
7686
exchange_servicer,
87+
tendermint_servicer,
7788
inj_usdt_spot_market_meta,
7889
ape_usdt_spot_market_meta,
7990
btc_usdt_perp_market_meta,
@@ -163,6 +174,7 @@ async def test_initialize_tokens_and_markets(
163174
)
164175

165176
client.chain_exchange_v2_api._stub = exchange_servicer
177+
client.tendermint_api._stub = tendermint_servicer
166178

167179
await client._initialize_tokens_and_markets()
168180

@@ -199,6 +211,7 @@ async def test_initialize_tokens_and_markets(
199211
async def test_tokens_and_markets_initialization_read_tokens_from_official_list(
200212
self,
201213
exchange_servicer,
214+
tendermint_servicer,
202215
inj_usdt_spot_market_meta,
203216
ape_usdt_spot_market_meta,
204217
btc_usdt_perp_market_meta,
@@ -255,6 +268,7 @@ async def test_tokens_and_markets_initialization_read_tokens_from_official_list(
255268
)
256269

257270
client.chain_exchange_v2_api._stub = exchange_servicer
271+
client.tendermint_api._stub = tendermint_servicer
258272

259273
await client._initialize_tokens_and_markets()
260274

@@ -267,6 +281,7 @@ async def test_initialize_tokens_from_chain_denoms(
267281
self,
268282
bank_servicer,
269283
exchange_servicer,
284+
tendermint_servicer,
270285
smart_denom_metadata,
271286
aioresponses,
272287
):
@@ -296,8 +311,9 @@ async def test_initialize_tokens_from_chain_denoms(
296311
network=test_network,
297312
)
298313

299-
client.chain_exchange_v2_api._stub = exchange_servicer
300314
client.bank_api._stub = bank_servicer
315+
client.chain_exchange_v2_api._stub = exchange_servicer
316+
client.tendermint_api._stub = tendermint_servicer
301317

302318
await client._initialize_tokens_and_markets()
303319
await client.initialize_tokens_from_chain_denoms()

0 commit comments

Comments
 (0)