-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Is your feature request related to a problem? Please describe.
I have some notebooks that I test with multiple versions of Python, but they are not compatible with Python 3.13. I would love to be able to exit early from these notebooks without causing the test to be reported as a failure.
Describe the solution you'd like
I have tried the following cells:
import sys
# Python 3.13 is not yet a supported runtime.
if sys.version_info >= (3, 13, 0):
sys.exit(0)also
import sys
# Python 3.13 is not yet a supported runtime.
if sys.version_info >= (3, 13, 0):
import pytest
pytest.skip("Python 3.13 not supported", allow_module_level=True)I would expect at least the latter to work, if not both. Note: one can disambiguate if SystemExit exception is "ok" / intended from a failure by looking at SystemExit.code == 0.
Describe alternatives you've considered
-
I've also tried creating an autouse fixture in a
conftext.pyfile that wraps theyieldin atry/exceptblock to capture these expected exceptions, but it seemsconftest.pyfixtures don't run. Perhaps an alternative to consider to allow such flexibility. -
I've tried the
"metadata": { "tags": [ "raises-exception" ] }on the cell, but this actually continues execution after the failed cell. I suspect this is desirable to have code cells that demonstrate exceptions, but it wasn't the right solution to be able to exit early.
Additional context
N/A