You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
importsys# Python 3.13 is not yet a supported runtime.ifsys.version_info>= (3, 13, 0):
sys.exit(0)
also
importsys# Python 3.13 is not yet a supported runtime.ifsys.version_info>= (3, 13, 0):
importpytestpytest.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.py file that wraps the yield in a try / except block to capture these expected exceptions, but it seems conftest.py fixtures 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
The text was updated successfully, but these errors were encountered:
summary=f"Error - No such kernel: '{err.name}'"# type: ignore
error=NotebookError(
summary=summary,
trace=f"{summary}",
failing_cell_index=0,
)
We could explicitly catch SystemExit (if exc.code == 0: pass; else error = NotebookError(...);) / the pytest.skip.Skipped exception. Though, maybe those end up being wrapped by one of those CellExecutionErrors?
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:
also
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.py
file that wraps theyield
in atry
/except
block to capture these expected exceptions, but it seemsconftest.py
fixtures 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
The text was updated successfully, but these errors were encountered: