-
Notifications
You must be signed in to change notification settings - Fork 50
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
Fix doctests to work with pytest. #802
Conversation
The current error looks to be related to the upload of coverage artifacts I think. FYI, the Windows test is a false positive, the tests actually failed on import but it's reporting a success on this dashboard anyway. For some reason all doctests are doubled up, with a copy in some |
@vyasr I couldn’t figure out how the I’ll look at the failing tests later, I have a lot going on right now. Anyone can feel free to take a look or push to this branch. |
I got the doctests to run successfully, but I am seeing an unrelated error in CI from either @glotzerlab/freud-maintainers Since I'm not sure if our code coverage is being reported correctly anyway, I think the next step is to disable coverage/codecov before merging this PR. Thoughts on this? See also: codecov deprecation: glotzerlab/signac#630 |
The issue upstream in
This PR can be merged once a new version of coverage is released and we upgrade the pinning. I don't really want to disable coverage in our CI (even though it's not currently working), but that would be another option. |
Codecov Report
@@ Coverage Diff @@
## master #802 +/- ##
=======================================
Coverage 55.34% 55.34%
=======================================
Files 16 16
Lines 2564 2564
Branches 34 34
=======================================
Hits 1419 1419
Misses 1131 1131
Partials 14 14
Continue to review full report at Codecov.
|
@tommy-waltmann I went ahead and merged this since it affects tests and had been stalled. We want any new PRs to have their documentation examples tested. This was blocked until coverage 6.1 was released, which fixed the failing tests. |
Description
Examples in docstrings were not being tested since the switch to pytest.
This is because the
load_tests
function is not recognized by pytest, only unittest.I attempted to use
pytest --doctest-modules
but that isn't quite what we want, and it appears to only work with pure Python (not Cython) modules.Instead, I adopted a variation on the strategy proposed in this StackOverflow post:
https://stackoverflow.com/questions/16982514/python-test-discovery-with-doctests-coverage-and-parallelism
Motivation and Context
Ensures that docstrings are runnable. I noticed the issue while reviewing #793.
How Has This Been Tested?
Tests should pass and show output like
test_docstrings[freud.box.Box.center]
.Types of changes
Checklist: