Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cdadaf3

Browse filesBrowse files
committed
test: lowered receipt timeout in tests
1 parent 5fd95d2 commit cdadaf3
Copy full SHA for cdadaf3

File tree

Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed

‎tests/test_uniswap.py

Copy file name to clipboardExpand all lines: tests/test_uniswap.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
else:
2626
UNISWAP_VERSIONS = [1, 2, 3]
2727

28+
RECEIPT_TIMEOUT = 5
29+
2830

2931
@dataclass
3032
class GanacheInstance:
@@ -54,12 +56,12 @@ def test_assets(client: Uniswap):
5456
logger.info("Buying...")
5557

5658
tx = client.make_trade_output(tokens["ETH"], token_addr, amount)
57-
client.w3.eth.wait_for_transaction_receipt(tx)
59+
client.w3.eth.wait_for_transaction_receipt(tx, timeout=RECEIPT_TIMEOUT)
5860

5961

6062
@pytest.fixture(scope="module")
6163
def web3(ganache: GanacheInstance):
62-
w3 = Web3(Web3.HTTPProvider(ganache.provider, request_kwargs={"timeout": 60}))
64+
w3 = Web3(Web3.HTTPProvider(ganache.provider, request_kwargs={"timeout": 30}))
6365
if 1 != int(w3.net.version):
6466
raise Exception("PROVIDER was not a mainnet provider, which the tests require")
6567
return w3
@@ -219,7 +221,7 @@ def get_exchange_rate(
219221
)
220222
def test_add_liquidity(self, client: Uniswap, web3: Web3, token, max_eth):
221223
r = client.add_liquidity(token, max_eth)
222-
tx = web3.eth.wait_for_transaction_receipt(r, timeout=6000)
224+
tx = web3.eth.wait_for_transaction_receipt(r, timeout=RECEIPT_TIMEOUT)
223225
assert tx["status"]
224226

225227
@pytest.mark.skip
@@ -274,7 +276,7 @@ def test_make_trade(
274276
bal_in_before = client.get_token_balance(input_token)
275277

276278
txid = client.make_trade(input_token, output_token, qty, recipient)
277-
tx = web3.eth.wait_for_transaction_receipt(txid)
279+
tx = web3.eth.wait_for_transaction_receipt(txid, timeout=RECEIPT_TIMEOUT)
278280
assert tx["status"]
279281

280282
# TODO: Checks for ETH, taking gas into account
@@ -324,7 +326,7 @@ def test_make_trade_output(
324326
balance_before = client.get_token_balance(output_token)
325327

326328
r = client.make_trade_output(input_token, output_token, qty, recipient)
327-
tx = web3.eth.wait_for_transaction_receipt(r, timeout=30)
329+
tx = web3.eth.wait_for_transaction_receipt(r, timeout=RECEIPT_TIMEOUT)
328330
assert tx["status"]
329331

330332
# TODO: Checks for ETH, taking gas into account

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.