-
Notifications
You must be signed in to change notification settings - Fork 18
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 notebook markers #95
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #95 +/- ##
==========================================
- Coverage 92.46% 92.10% -0.37%
==========================================
Files 4 4
Lines 146 190 +44
==========================================
+ Hits 135 175 +40
- Misses 11 15 +4
|
Thanks @mcflugen for this contribution, it's a great idea for a feature. Some notes:
|
@alex-treebeard Ugh. So sorry for the delay on this!
I've done this so that markers are no specified in the {
"cells": [ ... ],
"metadata": {
"kernelspec": { ... },
"execution": {
"nbmake": {
"markers": ["slow"]
}
}
}
}
Maybe you could give me some more guidance on this? |
hey @mcflugen - thanks for much for continuing this contribution. Many people use this library but very few help improve it. The issue is specifically: I can see that during test collection (the phase before tests are executed) - your new code will throw an unhandled exception if there is an invalid notebook. My ask is that we err on the side of not breaking existing usage and ignore invalid notebooks at collection time (ideally printing a warning to the user). In practice, this means you need to run this test, see that it's broken on your end, then push a fix. Thanks again, and I'm looking forward to merging and releasing this once the tests pass. EDIT: If you have a better idea for handling invalid json at collection time then happy to hear your approach. |
Apologies for the unsolicited pull request. I've added a small bit of functionality to nbmake that we have found to be useful and thought others might as well.
This pull request allows users to mark notebooks in a way similar to what one might do with
@pytest.mark
. Markers are included within a notebook's metadata much like how the allow_errors and timeout options are specified. As an example,would mark this notebook as "slow".
Markers can be either an array of strings (i.e.
["slow", "memory_intensive"
) or a string of comma-separated markers (i.e."slow,memory_intensive"
). Notebooks can then be included or excluded in the tests through the-m
option just as with other pytest tests (e.g.pytest **/*.ipynb -m "slow and not memory_intensive"
would only run notebooks that are slow but not memory intensive).If this is something you think could be a part of nbmake (great!), I can add some tests and write a bit of documentation to go with this. If not, no worries.