Skip to content
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
29 changes: 29 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Coverage configuration.
#
# This lives in a dedicated .coveragerc (INI) rather than pyproject.toml so
# that it can be read by any coverage install. The OpenAstronomy tox workflow
# runs `coverage combine`/`coverage xml` in the repo root via `uvx coverage`,
# which installs a bare `coverage` without the `[toml]` extra. On Python < 3.11
# (no stdlib tomllib) that build cannot parse a pyproject.toml config and fails
# with "Can't read 'pyproject.toml' without TOML support".
[run]
omit = tests/*

[report]
exclude_lines =
# Have to re-enable the standard pragma
# and branches that don't pertain to this version of Python
pragma: no cover
pragma: py{ignore_python_version}
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
# Don't complain if non-runnable code isn't run
if __name__ == .__main__.:
# Don't complain about abstract methods, they aren't run:
@(abc\.)?abstractmethod
# Exclude type check blocks and Protocol contents, they aren't run:
if TYPE_CHECKING:
\.\.\.
# Don't complain about IPython completion helper
def _ipython_key_completions_
6 changes: 3 additions & 3 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:
- linux: py310-test-cov
- linux: py312-test-cov
# All deps tests
- linux: py311-test-alldeps
- linux: py311-test-alldeps-cov
toxargs: '-v --develop'
- linux: py39-test-oldestdeps-alldeps-cov-clocale
# Platform test
- windows: py311-test-alldeps
# - macos: py311-test-alldeps # TODO: https://github.com/OpenAstronomy/github-actions-workflows/issues/197
- windows: py311-test-alldeps-cov
# - macos: py311-test-alldeps-cov # TODO: https://github.com/OpenAstronomy/github-actions-workflows/issues/197

conda: false
coverage: codecov
Expand Down
24 changes: 2 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,8 @@
documentation = "https://cosmology.readthedocs.org/projects/api"


[tool.coverage.run]
omit = ["tests/*"]

[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
# and branches that don't pertain to this version of Python
"pragma: no cover",
"pragma: py{ignore_python_version}",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run
"if __name__ == .__main__.:",
# Don't complain about abstract methods, they aren't run:
'@(abc\.)?abstractmethod',
# Exclude type check blocks and Protocol contents, they aren't run:
"if TYPE_CHECKING:",
'\.\.\.',
# Don't complain about IPython completion helper
"def _ipython_key_completions_",
]
# NOTE: coverage configuration lives in .coveragerc (not here) so that the
# bare `coverage` used by the CI workflow can read it without TOML support.

[tool.hatch]
build.targets.sdist.exclude = [
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extras =
commands =
pip freeze
!cov-!double: pytest --pyargs {toxinidir}/tests {toxinidir}/docs {posargs}
cov-!double: pytest --pyargs {toxinidir}/tests {toxinidir}/docs --cov cosmology --cov-config={toxinidir}/pyproject.toml {posargs}
cov-!double: pytest --pyargs {toxinidir}/tests {toxinidir}/docs --cov cosmology --cov-config={toxinidir}/.coveragerc {posargs}
cov: coverage xml -o {toxinidir}/coverage.xml


Expand Down
Loading