-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
ENH: Configure pytest to use DTChecker #71
Conversation
@ev-br ![]() ![]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the failure locally, so not sure how to reproduce 🤔
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the fact that it now reuses existing test cases!
I also like the fact that the patch to switch on DTChecker is a three-liner.
That said:
- can you add a test using pytest CLI on CI? Both to make sure this works with
$ pytest ...
CLI interface, and to serve as a canonical reference of how to use it. Have a look at at https://github.com/ev-br/scpdt/blob/main/.github/workflows/pip.yml, it has several steps for various ways to run it the "classic" way. - Currently it seems to monkey-patch the pytest plugin, correct? Would be good to understand how robust this is for future maintenance. Are we reaching into private pytest details which can change in a future pytest version?
- Would be good to look at prior art: pytest-doctestplus and xdoctest. Are they doing similar things? If they do things differently, then how? Are their ways a historic baggage or more robust? Etc.
|
Thanks for the explanations Sheila. Would be nice to somehow check / make sure that the added
Makes sense! All that said, this pull request LGTM. Feel free to merge if it helps iterating (or keep adding things to this branch, whichever works for you @Sheila-nk). |
Thanks for your review @ev-br 😄
Thanks for catching this. So to ensure that |
For now, I have added the CI test that performs doctesting on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, I have added the CI test that performs doctesting on the module_cases
Confirmed locally that
$ python -m pytest scpdt/tests/module_cases.py --doctest-modules
passes in a venv where scpdt is installed and fails in a venv where it is not. Great!
Optionally, might want to add a more explicit comment, along the lines of "fails unless the plugin is activated".
Oh! sorry @ev-br . Instead of quoting your comment, I accidentally edited it, but I have restored it. Apologies!!
Yes. Maybe it would also be a good idea to start updating the documentation. |
Yes for updating the documentation. This PR or a sequel, up to you. |
Great! Will update the documentation in a different PR. |
Thanks again @ev-br for the review and approval. |
pytest_configure
hook to registerDTChecker
as a plugin thus allowing pytest to use it during doctest execution._get_checker
function to return theDTChecker
.default_namespace
attribute to {} for explicit import ofnumpy
in test examples.numpy
in all docstring test examples.Closes #72