Skip to content

Commit

Permalink
tools: include integration tests in coverage
Browse files Browse the repository at this point in the history
It makes sense to include the integration tests in the total coverage
metric because in craft-cli the integration tests are more about
testing the actual public api end-to-end. Often, these are the tests
that better reflect the real-world use of the package and the tests
that have a better chance of surviving true internal refactorings
without changes.
  • Loading branch information
tigarmo committed Aug 15, 2023
1 parent 76e99ec commit 56ad8e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ branch = true
parallel = false
omit = ["tests/**"]

[tool.coverage.report]
skip_empty = true
fail_under = 74

[tool.pyright]
#strict = ["craft_cli"] # NOTE: disabled pending fix of the many errors (see gh issue #147)
pythonVersion = "3.8"
Expand Down
7 changes: 6 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ base = testenv, test
description = Run integration tests with pytest
labels =
py38, py310, py311: tests, integration-tests
commands = pytest {tty:--color=yes} --junit-xml=results/test-results-{env_name}.xml tests/integration {posargs}
commands =
# NOTE: we use `coverage` directly here instead of pytest-cov because the loading of the
# pytest plugin provided by craft-cli means that some code gets imported *before*
# pytest-cov gets started, and those lines are marked as misses.
coverage run --source craft_cli -m pytest {tty:--color=yes} --junit-xml=results/test-results-{env_name}.xml tests/integration {posargs}
coverage xml -o results/coverage-{env_name}.xml

[lint] # Standard linting configuration
package = editable
Expand Down

0 comments on commit 56ad8e7

Please sign in to comment.