diff --git a/Makefile b/Makefile index 9bb4246..8c74a05 100644 --- a/Makefile +++ b/Makefile @@ -12,11 +12,11 @@ lint-fix: .PHONY: test test: - poetry run pytest -m "not e2e" + poetry run pytest .PHONY: e2e e2e: - poetry run pytest -m "e2e" + poetry run pytest -m "tests and e2e" .PHONY: repl repl: diff --git a/pyproject.toml b/pyproject.toml index 0980f29..795eb5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,12 +66,13 @@ known-first-party = ["cdp"] [tool.pytest.ini_options] minversion = "6.0" -addopts = "-ra -q --cov=cdp --cov-report=term-missing" +addopts = "-ra -q --cov=cdp --cov-report=term-missing -m 'not e2e'" testpaths = [ "tests", ] markers = [ - "e2e: marks tests as e2e, requiring env, deselect with '-m \"not e2e\"'", + "tests: tests", + "e2e: e2e tests, requiring env, deselect with '-m \"not e2e\"'", ] [tool.coverage.run] diff --git a/tests/conftest.py b/tests/conftest.py index 627976e..25ff473 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import os +import pytest factory_modules = [ f[:-3] for f in os.listdir("./tests/factories") if f.endswith(".py") and f != "__init__.py" diff --git a/tests/test_e2e.py b/tests/test_e2e.py index 7e11cbd..0016c3c 100644 --- a/tests/test_e2e.py +++ b/tests/test_e2e.py @@ -35,6 +35,8 @@ def imported_wallet(wallet_data): return Wallet.import_data(WalletData.from_dict(wallet_data)) +@pytest.mark.tests +@pytest.mark.e2e def test_wallet_data(wallet_data): """Test wallet data format and required values.""" expected = { @@ -49,6 +51,7 @@ def test_wallet_data(wallet_data): assert value is not None +@pytest.mark.tests @pytest.mark.e2e def test_wallet_import(wallet_data): """Test wallet import functionality.""" @@ -65,6 +68,7 @@ def test_wallet_import(wallet_data): assert imported_wallet.default_address.address_id == default_address_id +@pytest.mark.tests @pytest.mark.e2e def test_wallet_faucet(imported_wallet): """Test wallet faucet with ETH.""" @@ -79,6 +83,7 @@ def test_wallet_faucet(imported_wallet): assert final_eth_balance > initial_eth_balance +@pytest.mark.tests @pytest.mark.e2e def test_wallet_faucet_usdc(imported_wallet): """Test wallet faucet with USDC.""" @@ -93,6 +98,7 @@ def test_wallet_faucet_usdc(imported_wallet): assert final_usdc_balance > initial_usdc_balance +@pytest.mark.tests @pytest.mark.e2e def test_wallet_transfer(imported_wallet): """Test wallet transfer.""" @@ -119,6 +125,7 @@ def test_wallet_transfer(imported_wallet): assert final_dest_balance > initial_dest_balance +@pytest.mark.tests @pytest.mark.e2e def test_transaction_history(imported_wallet): """Test transaction history retrieval.""" @@ -147,6 +154,7 @@ def test_transaction_history(imported_wallet): assert matching_tx.status.value == "complete" +@pytest.mark.tests @pytest.mark.e2e def test_wallet_export(imported_wallet): """Test wallet export.""" @@ -175,6 +183,7 @@ def test_wallet_export(imported_wallet): os.unlink("test_seed.json") +@pytest.mark.tests @pytest.mark.e2e def test_wallet_addresses(imported_wallet): """Test wallet addresses retrieval.""" @@ -183,6 +192,7 @@ def test_wallet_addresses(imported_wallet): assert imported_wallet.default_address in addresses +@pytest.mark.tests @pytest.mark.e2e def test_wallet_balances(imported_wallet): """Test wallet balances retrieval.""" @@ -190,6 +200,7 @@ def test_wallet_balances(imported_wallet): assert balances.get("eth") > 0 +@pytest.mark.tests @pytest.mark.e2e def test_historical_balances(imported_wallet): """Test historical balance retrieval."""