Skip to content

Commit

Permalink
Ignore Kernel died in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Sep 16, 2023
1 parent 3f96806 commit e1f8c85
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,23 @@
"gallery/demos/*/bachelors_degrees_by_gender.ipynb",
"gallery/demos/*/topographic_hillshading.ipynb",
]


def pytest_runtest_makereport(item, call):
"""
Skip tests that fail because the kernel died before replying to kernel_info
this is a common error when running the example tests
Inspired from: https://stackoverflow.com/questions/32451811
"""
from _pytest.runner import pytest_runtest_makereport
tr = pytest_runtest_makereport(item, call)

if call.excinfo is not None:
msg = "Kernel died before replying to kernel_info"
if call.excinfo.type == RuntimeError and call.excinfo.value.args[0] == msg:
tr.outcome = 'skipped'
tr.wasxfail = f"reason: {msg}"

return tr

0 comments on commit e1f8c85

Please sign in to comment.