Skip to content

tests: use NotImplementedError with uncovered code #6538

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

Merged
merged 1 commit into from
Jan 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions testing/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def test_outcomeexception_passes_except_Exception() -> None:
try:
raise outcomes.OutcomeException("test")
except Exception:
pass
raise NotImplementedError()


def test_pytest_exit() -> None:
Expand Down Expand Up @@ -740,8 +740,9 @@ def f():
mod2 = pytest.importorskip("hello123", minversion="1.3")
assert mod2 == mod
except Skipped:
print(_pytest._code.ExceptionInfo.from_current())
pytest.fail("spurious skip")
raise NotImplementedError(
"spurious skip: {}".format(_pytest._code.ExceptionInfo.from_current())
)


def test_importorskip_imports_last_module_part() -> None:
Expand All @@ -759,8 +760,9 @@ def test_importorskip_dev_module(monkeypatch) -> None:
with pytest.raises(Skipped):
pytest.importorskip("mockmodule1", minversion="0.14.0")
except Skipped:
print(_pytest._code.ExceptionInfo.from_current())
pytest.fail("spurious skip")
raise NotImplementedError(
"spurious skip: {}".format(_pytest._code.ExceptionInfo.from_current())
)


def test_importorskip_module_level(testdir) -> None:
Expand Down Expand Up @@ -1030,7 +1032,7 @@ def test_outcome_exception_bad_msg() -> None:
"""Check that OutcomeExceptions validate their input to prevent confusing errors (#5578)"""

def func() -> None:
pass
raise NotImplementedError()

expected = (
"OutcomeException expected string as 'msg' parameter, got 'function' instead.\n"
Expand Down