diff --git a/integration_tests/conftest.py b/integration_tests/conftest.py index 980d4a9627..a09a5741ba 100644 --- a/integration_tests/conftest.py +++ b/integration_tests/conftest.py @@ -61,7 +61,7 @@ def geth(tmp_path_factory): yield from setup_geth(path, 8545) -@pytest.fixture(scope="session", params=["cronos", "geth", "cronos-ws"]) +@pytest.fixture(scope="session") def cluster(request, cronos, geth): """ run on both cronos and geth diff --git a/integration_tests/test_basic.py b/integration_tests/test_basic.py index 7057644e67..0f3c6205dc 100644 --- a/integration_tests/test_basic.py +++ b/integration_tests/test_basic.py @@ -16,6 +16,7 @@ ADDRS, CONTRACTS, KEYS, + PROVIDERS, Greeter, RevertTestContract, approve_proposal, @@ -34,11 +35,13 @@ ) +@pytest.mark.parametrize("cluster", PROVIDERS, indirect=True) def test_basic(cluster): w3 = cluster.w3 assert w3.eth.chain_id == 777 +@pytest.mark.parametrize("cluster", PROVIDERS, indirect=True) def test_send_transaction(cluster): "test eth_sendTransaction api" w3 = cluster.w3 @@ -53,7 +56,8 @@ def test_send_transaction(cluster): assert receipt.status == 1 -def test_events(cluster, suspend_capture): +@pytest.mark.parametrize("cluster", PROVIDERS, indirect=True) +def test_events(cluster): w3 = cluster.w3 erc20 = deploy_contract( w3, @@ -524,6 +528,7 @@ def assert_receipt_transaction_and_block(w3, futures): assert transaction["blockNumber"] == block["number"] +@pytest.mark.parametrize("cluster", PROVIDERS, indirect=True) def test_exception(cluster): w3 = cluster.w3 contract = deploy_contract( @@ -543,6 +548,7 @@ def test_exception(cluster): assert 5 * (10**18) == contract.caller.query() +@pytest.mark.parametrize("cluster", PROVIDERS, indirect=True) def test_refund_unused_gas_when_contract_tx_reverted(cluster): """ Call a smart contract method that reverts with very high gas limit @@ -594,6 +600,7 @@ def test_message_call(cronos): assert len(receipt.logs) == iterations +@pytest.mark.parametrize("cluster", PROVIDERS, indirect=True) def test_suicide(cluster): """ test compliance of contract suicide @@ -747,6 +754,7 @@ def test_failed_transfer_tx(cronos): assert receipt.gasUsed == rsp["gas"] +@pytest.mark.parametrize("cluster", PROVIDERS, indirect=True) def test_log0(cluster): """ test compliance of empty topics behavior diff --git a/integration_tests/test_filters.py b/integration_tests/test_filters.py index cbde7eeb88..93ad4127a8 100644 --- a/integration_tests/test_filters.py +++ b/integration_tests/test_filters.py @@ -1,14 +1,17 @@ from web3 import Web3 +import pytest from .utils import ( ADDRS, CONTRACTS, + PROVIDERS, deploy_contract, send_transaction, wait_for_new_blocks, ) +@pytest.mark.parametrize("cluster", PROVIDERS, indirect=True) def test_pending_transaction_filter(cluster): w3: Web3 = cluster.w3 flt = w3.eth.filter("pending") diff --git a/integration_tests/utils.py b/integration_tests/utils.py index a51bb26a32..bc425789cd 100644 --- a/integration_tests/utils.py +++ b/integration_tests/utils.py @@ -88,6 +88,8 @@ def contract_path(name, filename): "IICAModule": Path(__file__).parent.parent / "build/IICAModule.abi", } +PROVIDERS = ["cronos", "geth", "cronos-ws"] + def wait_for_fn(name, fn, *, timeout=240, interval=1): for i in range(int(timeout / interval)): diff --git a/scripts/run-integration-tests b/scripts/run-integration-tests index 258efd4d72..cb2d708a0d 100755 --- a/scripts/run-integration-tests +++ b/scripts/run-integration-tests @@ -10,4 +10,4 @@ cd ../integration_tests/contracts HUSKY_SKIP_INSTALL=1 npm install npm run typechain cd .. -nix-shell --run "pytest -n auto -v -s test_basic.py::test_basic" \ No newline at end of file +nix-shell --run "pytest -n 1 -v -s test_basic.py" \ No newline at end of file