-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add a coverage plugin that handles ipykernel cells #110
Conversation
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.
Thanks. Line and Branch Coverage help check code quality.
Common misconception: if something has 100% test coverage, it's also fuzzed.
also, re: hypothesis property testing and pytest-cov: https://hypothesis.readthedocs.io/en/latest/strategies.html#interaction-with-pytest-cov
plugins = | ||
ipytest.cov | ||
``` | ||
|
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.
The %%file
cell magic can be used to create files like .coveragerc
from a notebook.
%%file .coveragerc
[run]
plugins =
ipytest.cov
Would an ipytest.generate_coveragerc()
or similar be too much? or Just autoconfig(coverage=True)
or something?
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.
TBH. I would rather prefer, that there is an option to configure pytest-cov programatically and inject the plugin in that way. I will open an issue for further discussion.
Open issues:
C:/Users/{USER}/AppData/Local/Temp/ipykernel_1300/3920661193.py
,C:/Users/{USER}/AppData/Local/Temp
works,C:/Users/{USER}/AppData/Local/Temp/ipykernel_1300
does not%%ipytest --cov
gets completed to%%ipytest --cov {MODULE}
. Therefore{MODULE}
is added to the sources. Using%%ipytest --cov -vv
works correctly.--
in the defopts to make sure the inserted module is never parsed an argument valueNotes:
ipykernel
uses a custom caching compiler (source){TMP_PATH}/ipykernel_{pid}/{code_hash}.py
(source)