Skip to content

Commit 6a63c74

Browse files
authored
Fix coverage report to include all executed tests (#1213)
* Fix coverage report to include all executed tests * Fix typos * Fix typecheck
1 parent 7aaaf3a commit 6a63c74

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

pyproject.toml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,37 @@ cairo-lang = {version = "0.12.2", python = ">=3.9, <3.10"}
5454
starknet-devnet = {version = "0.6.2", python = ">=3.9, <3.10"}
5555

5656
[tool.poe.tasks]
57-
test.shell = "pytest -n auto -v --reruns 10 --only-rerun aiohttp.client_exceptions.ClientConnectorError --cov=starknet_py starknet_py"
57+
test = [
58+
"clean_coverage",
59+
"test_ci_gateway_v1 --disable-warnings -qq",
60+
"test_ci_full_node_v1 --disable-warnings -qq",
61+
"test_ci_gateway_v2 --disable-warnings -qq",
62+
"test_ci_full_node_v2 --disable-warnings -qq",
63+
"test_ci_on_networks_gateway --disable-warnings -qq",
64+
"test_ci_on_networks_full_node --disable-warnings -qq",
65+
"test_report --skip-covered"
66+
]
5867

5968
test_ci = ["test_ci_gateway_v1", "test_ci_full_node_v1", "test_ci_gateway_v2", "test_ci_full_node_v2"]
60-
test_ci_gateway_v1.shell = "coverage run -m pytest --client=gateway --contract_dir=v1 -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/core --ignore=starknet_py/tests/e2e/tests_on_networks"
61-
test_ci_full_node_v1.shell = "coverage run -m pytest --client=full_node --contract_dir=v1 -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/core --ignore=starknet_py/tests/e2e/tests_on_networks"
62-
test_ci_gateway_v2.shell = "coverage run -m pytest --client=gateway --contract_dir=v2 -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/core --ignore=starknet_py/tests/e2e/tests_on_networks"
63-
test_ci_full_node_v2.shell = "coverage run -m pytest --client=full_node --contract_dir=v2 -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/core --ignore=starknet_py/tests/e2e/tests_on_networks"
69+
test_ci_gateway_v1 = "coverage run -a -m pytest --client=gateway --contract_dir=v1 starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/core --ignore=starknet_py/tests/e2e/tests_on_networks"
70+
test_ci_full_node_v1 = "coverage run -a -m pytest --client=full_node --contract_dir=v1 starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/core --ignore=starknet_py/tests/e2e/tests_on_networks"
71+
test_ci_gateway_v2 = "coverage run -a -m pytest --client=gateway --contract_dir=v2 starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/core --ignore=starknet_py/tests/e2e/tests_on_networks"
72+
test_ci_full_node_v2 = "coverage run -a -m pytest --client=full_node --contract_dir=v2 starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/core --ignore=starknet_py/tests/e2e/tests_on_networks"
6473

6574
# order of tests below is important, explanation in /tests_on_networks/client_test.py above 'test_wait_for_tx_reverted_full_node'
6675
test_ci_on_networks = ["test_ci_on_networks_full_node", "test_ci_on_networks_gateway"]
67-
test_ci_on_networks_gateway = "coverage run -m pytest --client=gateway -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py/tests/e2e/tests_on_networks"
68-
test_ci_on_networks_full_node = "coverage run -m pytest --client=full_node -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py/tests/e2e/tests_on_networks"
76+
test_ci_on_networks_gateway = "coverage run -a -m pytest --client=gateway starknet_py/tests/e2e/tests_on_networks"
77+
test_ci_on_networks_full_node = "coverage run -a -m pytest --client=full_node starknet_py/tests/e2e/tests_on_networks"
6978

7079
test_ci_docs = ["test_ci_docs_gateway_v1", "test_ci_docs_full_node_v1", "test_ci_docs_gateway_v2", "test_ci_docs_full_node_v2"]
71-
test_ci_docs_gateway_v1.shell = "coverage run -m pytest --client=gateway --contract_dir=v1 -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py/tests/e2e/docs"
72-
test_ci_docs_full_node_v1.shell = "coverage run -m pytest --client=full_node --contract_dir=v1 -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py/tests/e2e/docs"
73-
test_ci_docs_gateway_v2.shell = "coverage run -m pytest --client=gateway --contract_dir=v2 -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py/tests/e2e/docs"
74-
test_ci_docs_full_node_v2.shell = "coverage run -m pytest --client=full_node --contract_dir=v2 -v --reruns 5 --only-rerun aiohttp.client_exceptions.ClientConnectorError starknet_py/tests/e2e/docs"
75-
76-
test_unit.shell = "pytest -n auto -v starknet_py --ignore=starknet_py/tests/e2e"
77-
test_e2e.shell = "pytest -n auto -v starknet_py/tests/e2e --ignore=starknet_py/tests/e2e/docs"
78-
test_docs.shell = "pytest -n auto -v starknet_py/tests/e2e/docs"
79-
test_core.shell = "pytest -v starknet_py/tests/e2e/core --net=integration"
80-
test_report.shell = "coverage report"
80+
test_ci_docs_gateway_v1 = "coverage run -a -m pytest --client=gateway --contract_dir=v1 starknet_py/tests/e2e/docs"
81+
test_ci_docs_full_node_v1 = "coverage run -a -m pytest --client=full_node --contract_dir=v1 starknet_py/tests/e2e/docs"
82+
test_ci_docs_gateway_v2 = "coverage run -a -m pytest --client=gateway --contract_dir=v2 starknet_py/tests/e2e/docs"
83+
test_ci_docs_full_node_v2 = "coverage run -a -m pytest --client=full_node --contract_dir=v2 starknet_py/tests/e2e/docs"
84+
85+
test_report = "coverage report -m"
8186
test_html.shell = "coverage html && open ./htmlcov/index.html"
87+
clean_coverage = "coverage erase"
8288
docs_create = { shell = "make -C docs html" }
8389
docs_open = { shell = "open docs/_build/html/index.html" }
8490
lint = "pylint starknet_py"
@@ -102,7 +108,7 @@ source = ["starknet_py"]
102108

103109

104110
[tool.coverage.report]
105-
omit = ["*_test.py", "starknet_py/tests/e2e/*", "starknet_py/utils/docs.py"]
111+
omit = ["*_test.py", "test_*.py", "starknet_py/tests/*"]
106112
skip_empty = true
107113

108114

@@ -128,6 +134,11 @@ profile = "black"
128134
skip_gitignore = true
129135

130136
[tool.pytest.ini_options]
137+
addopts = [
138+
"-v",
139+
"--reruns=5",
140+
"--only-rerun=aiohttp.client_exceptions.ClientConnectorError"
141+
]
131142
markers = [
132143
"run_on_testnet: marks test that will only run on testnet (when --net=testnet)",
133144
"run_on_devnet: marks test that will only run on devnet (when --net=devnet)"

0 commit comments

Comments
 (0)