Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage reporting to the test suite #52

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: pip install tox
- name: Run tox
# Run tox using the version of Python in `PATH`
run: tox -e py
run: tox -e py,coverage_report-ci

dist:
runs-on: ubuntu-latest
Expand Down
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,31 @@ build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
write_to = "flask_compress/_version.py"
write_to_template = "__version__ = \"{version}\"\n"


# coverage
# --------

[tool.coverage.run]
relative_files = true
parallel = true
branch = true
source = [
"flask_compress",
"tests",
]

[tool.coverage.paths]
source = [
"flask_compress",
"*/site-packages",
]

[tool.coverage.report]
skip_covered = true
fail_under = 94


[tool.coverage.html]
directory = "htmlcov/"
skip_covered = false
32 changes: 31 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
[tox]
skip_missing_interpreters = true
envlist =
coverage_erase
# When modifying the list of CPython and PyPy versions to test here,
# be sure to update the "depends" configurations elsewhere in this file.
# This ensures that coverage is reported only after all tests have run.
py{39, 310, 311, 312}
pypy{39, 310}
coverage_report

[testenv:coverage_erase]
description = Erase coverage files
deps =
coverage[toml]
commands =
- coverage erase

[testenv]
description = Run the test suite
depends =
py{39, 310, 311, 312},pypy{39, 310}: coverage_erase
package = wheel
wheel_build_env = .pkg
deps =
coverage[toml]
pytest
commands = py.test {posargs}
commands =
coverage run -m pytest {posargs}

[testenv:coverage_report{,-ci}]
description = Generate HTML and console coverage reports
depends =
py{39, 310, 311, 312},pypy{39, 310}
deps =
coverage[toml]
commands_pre =
- coverage combine
# Only generate an HTML coverage report when running locally.
!ci: - coverage html
commands =
coverage report

[flake8]
max-line-length = 88
Expand Down