Skip to content

Commit

Permalink
⚡ Remove --cov from pytest.ini_options
Browse files Browse the repository at this point in the history
Speeds up local test runs, especially when only wanting to run one or a couple tests at a time

Previously, running a single unit test took me 7.5 seconds, and now it takes 0.5 seconds.

This is because it takes 7 seconds to generate the coverage report (in te`rminal and xml file) for the whole acapy_agent folder, and `[tool.pytest.ini_options]` configures that all pytest runs include a coverage request.

This is hugely unnecessary to be forced on the developer every time they type pytest

If a developer wants to see a coverage report, they can add --cov at the end.
___
Impact: running tests locally are faster, and a developer will have to now type --cov if they ever want to see a coverage report.

Also, test output is more readable now, since it won't always include 100s of lines of coverage info.

No modification necessary for the github workflows, since they manually specify to run with --cov

Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 committed Feb 13, 2025
1 parent 3b8d91e commit a511f89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ line-length = 90
testpaths = "acapy_agent"
addopts = """
--quiet --junitxml=./test-reports/junit.xml
--cov-config .coveragerc --cov=acapy_agent --cov-report term --cov-report xml
--cov-config .coveragerc --cov-report term --cov-report xml
--ruff
"""
markers = [
Expand All @@ -139,7 +139,7 @@ markers = [
"indy: Tests specifically relating to Hyperledger Indy SDK support",
"indy_credx: Tests specifically relating to Indy-Credx support",
"indy_vdr: Tests specifically relating to Indy-VDR support",
"ursa_bbs_signatures: Tests specificaly relating to BBS Signatures support",
"ursa_bbs_signatures: Tests specifically relating to BBS Signatures support",
"postgres: Tests relating to the postgres storage plugin for Indy",
]
junit_family = "xunit1"
Expand All @@ -152,6 +152,7 @@ omit = ["*/tests/*", "demo/*", "docker/*", "docs/*", "scripts/*"]
data_file = "test-reports/.coverage"

[tool.coverage.report]
# include = ["acapy_agent"]
exclude_lines = ["pragma: no cover", "@abstract"]
precision = 2
skip_covered = true
Expand Down

0 comments on commit a511f89

Please sign in to comment.