From b099fcfa33ed03e0249d7ce183eacb476350ab70 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 21 Feb 2020 14:37:56 +0100 Subject: [PATCH] tests: runner: improve/ignore coverage (#6781) --- testing/test_runner.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/testing/test_runner.py b/testing/test_runner.py index 96693cf8c..ab4ae67e5 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -382,7 +382,7 @@ class BaseFunctionalTests: """ ) except SystemExit: - pytest.fail("runner did not catch SystemExit") + assert False, "runner did not catch SystemExit" rep = reports[1] assert rep.failed assert rep.when == "call" @@ -399,7 +399,7 @@ class BaseFunctionalTests: except pytest.exit.Exception: pass else: - pytest.fail("did not raise") + assert False, "did not raise" class TestExecutionNonForked(BaseFunctionalTests): @@ -420,7 +420,7 @@ class TestExecutionNonForked(BaseFunctionalTests): except KeyboardInterrupt: pass else: - pytest.fail("did not raise") + assert False, "did not raise" class TestExecutionForked(BaseFunctionalTests): @@ -735,9 +735,9 @@ def test_importorskip(monkeypatch) -> None: pytest.importorskip("hello123", minversion="1.3.1") mod2 = pytest.importorskip("hello123", minversion="1.3") assert mod2 == mod - except pytest.skip.Exception: - raise NotImplementedError( - "spurious skip: {}".format(_pytest._code.ExceptionInfo.from_current()) + except pytest.skip.Exception: # pragma: no cover + assert False, "spurious skip: {}".format( + _pytest._code.ExceptionInfo.from_current() ) @@ -755,9 +755,9 @@ def test_importorskip_dev_module(monkeypatch) -> None: assert mod2 == mod with pytest.raises(pytest.skip.Exception): pytest.importorskip("mockmodule1", minversion="0.14.0") - except pytest.skip.Exception: - raise NotImplementedError( - "spurious skip: {}".format(_pytest._code.ExceptionInfo.from_current()) + except pytest.skip.Exception: # pragma: no cover + assert False, "spurious skip: {}".format( + _pytest._code.ExceptionInfo.from_current() )