You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
Include the test suite in code coverage, via the coverage.run.source setting.
Rationale:
Tests are code.
Identify tests that aren’t running.
Ensure that test helpers are used and tested.
Caveats:
Coverage may require extra configuration if tests are deliberately excluded.
Tests may clutter the coverage report. Use --skip-covered if this is an issue.
The coverage metric generally goes up.
This PR also updates the coverage.paths setting, to map paths for the test suite to the local source tree. By default, coverage data contains absolute paths for the test suite. During CI, coverage data from various runners is combined in an environment where these paths do not exist. This results in errors like the following:
No source for code: '/Users/runner/work/cookiecutter-hypermodern-python-instance/cookiecutter-hypermodern-python-instance/tests/init.py'.
Aborting report output, consider using -i.
The coverage.run.relative_files setting is not an option here due to nedbat/coveragepy#991: Windows paths are stored with backslashes, triggering No source errors when the coverage data is combined on other platforms, such as the Ubuntu runner used in our coverage job:
No source for code: '/path/to/cookiecutter-hypermodern-python-instance/tests_init_.py'.
Note the backslash in the filename reported in the error message. If that upstream issue was fixed, we'd still need coverage.paths for src though. This is because relative paths for the installed package still include the location of the various Nox environments.
The text was updated successfully, but these errors were encountered:
Include the test suite in code coverage, via the coverage.run.source setting.
Rationale:
Caveats:
See https://nedbatchelder.com/blog/202008/you_should_include_your_tests_in_coverage.html
This PR also updates the coverage.paths setting, to map paths for the test suite to the local source tree. By default, coverage data contains absolute paths for the test suite. During CI, coverage data from various runners is combined in an environment where these paths do not exist. This results in errors like the following:
No source for code: '/Users/runner/work/cookiecutter-hypermodern-python-instance/cookiecutter-hypermodern-python-instance/tests/init.py'.
Aborting report output, consider using -i.
The coverage.run.relative_files setting is not an option here due to nedbat/coveragepy#991: Windows paths are stored with backslashes, triggering No source errors when the coverage data is combined on other platforms, such as the Ubuntu runner used in our coverage job:
No source for code: '/path/to/cookiecutter-hypermodern-python-instance/tests_init_.py'.
Note the backslash in the filename reported in the error message. If that upstream issue was fixed, we'd still need coverage.paths for src though. This is because relative paths for the installed package still include the location of the various Nox environments.
The text was updated successfully, but these errors were encountered: