Skip to content

Commit 43ba043

Browse files
committed
ENH: skip file after failure
1 parent f2c141d commit 43ba043

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

nbval/plugin.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,3 +926,19 @@ def _indent(s, indent=' '):
926926
if isinstance(s, str):
927927
return '\n'.join(('%s%s' % (indent, line) for line in s.splitlines()))
928928
return s
929+
930+
931+
skip_modules = []
932+
933+
934+
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
935+
def pytest_runtest_makereport(item, call):
936+
outcome = yield
937+
938+
if outcome.get_result().failed:
939+
skip_modules.append(item.path)
940+
941+
942+
def pytest_runtest_call(item):
943+
if item.path in skip_modules:
944+
pytest.skip(f"Due to the previous failure skipping rest of tests in {item.path}")

0 commit comments

Comments
 (0)