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

Exclude all test files from code coverage analysis #2692

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

eerovaher
Copy link
Member

Currently test directories are only excluded from coverage analysis if they are just under astroquery or separated from it by one directory, which means code in e.g. astroquery/esa/hsa/tests/test_hsa_remote.py is included in coverage analysis. The updated configuration in this pull request ensures all directories named tests are excluded no matter how deep in the directory hierarchy they are. See also https://coverage.readthedocs.io/en/7.2.2/source.html#file-patterns

Previously test directories were only excluded from coverage analysis if
they were just under `astroquery` or separated from it by one directory,
but now all directories named `tests` are excluded no matter how deep in
the directory hierarchy they are.
@bsipocz
Copy link
Member

bsipocz commented Mar 28, 2023

Thanks, this indeed makes some sense.

One case though where it could be beneficial to have coverage, is the mock classes, e.g. see astropy/pyvo#433 for a similar issue.

E.g. when a mock class is more feature rich than the actual tests using the class, a situation that could be somewhat misleading for the reader of the test file (e.g. seeing/extending the class with things only assumed to be used in the tests).

@bsipocz bsipocz merged commit beaed40 into astropy:main Mar 28, 2023
@eerovaher eerovaher deleted the remote-tests-coverage branch March 28, 2023 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants