tests: runner: improve/ignore coverage (#6781)

This commit is contained in:
Daniel Hahler 2020-02-21 14:37:56 +01:00 committed by GitHub
parent 4c9b850e13
commit b099fcfa33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -382,7 +382,7 @@ class BaseFunctionalTests:
""" """
) )
except SystemExit: except SystemExit:
pytest.fail("runner did not catch SystemExit") assert False, "runner did not catch SystemExit"
rep = reports[1] rep = reports[1]
assert rep.failed assert rep.failed
assert rep.when == "call" assert rep.when == "call"
@ -399,7 +399,7 @@ class BaseFunctionalTests:
except pytest.exit.Exception: except pytest.exit.Exception:
pass pass
else: else:
pytest.fail("did not raise") assert False, "did not raise"
class TestExecutionNonForked(BaseFunctionalTests): class TestExecutionNonForked(BaseFunctionalTests):
@ -420,7 +420,7 @@ class TestExecutionNonForked(BaseFunctionalTests):
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
else: else:
pytest.fail("did not raise") assert False, "did not raise"
class TestExecutionForked(BaseFunctionalTests): class TestExecutionForked(BaseFunctionalTests):
@ -735,9 +735,9 @@ def test_importorskip(monkeypatch) -> None:
pytest.importorskip("hello123", minversion="1.3.1") pytest.importorskip("hello123", minversion="1.3.1")
mod2 = pytest.importorskip("hello123", minversion="1.3") mod2 = pytest.importorskip("hello123", minversion="1.3")
assert mod2 == mod assert mod2 == mod
except pytest.skip.Exception: except pytest.skip.Exception: # pragma: no cover
raise NotImplementedError( assert False, "spurious skip: {}".format(
"spurious skip: {}".format(_pytest._code.ExceptionInfo.from_current()) _pytest._code.ExceptionInfo.from_current()
) )
@ -755,9 +755,9 @@ def test_importorskip_dev_module(monkeypatch) -> None:
assert mod2 == mod assert mod2 == mod
with pytest.raises(pytest.skip.Exception): with pytest.raises(pytest.skip.Exception):
pytest.importorskip("mockmodule1", minversion="0.14.0") pytest.importorskip("mockmodule1", minversion="0.14.0")
except pytest.skip.Exception: except pytest.skip.Exception: # pragma: no cover
raise NotImplementedError( assert False, "spurious skip: {}".format(
"spurious skip: {}".format(_pytest._code.ExceptionInfo.from_current()) _pytest._code.ExceptionInfo.from_current()
) )