diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index 52d5286b8..6ee848e54 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -131,7 +131,7 @@ class TestTraceback_f_g_h: try: raise ValueError except somenoname: # type: ignore[name-defined] # noqa: F821 - pass + pass # pragma: no cover try: xyz() @@ -475,7 +475,7 @@ class TestFormattedExcinfo: except BaseException: excinfo = _pytest._code.ExceptionInfo.from_current() else: - assert 0, "did not raise" + assert False, "did not raise" pr = FormattedExcinfo() source = pr._getentrysource(excinfo.traceback[-1]) diff --git a/testing/code/test_source.py b/testing/code/test_source.py index ea5b7a4a5..4222eb172 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -56,7 +56,7 @@ def test_source_from_lines() -> None: def test_source_from_inner_function() -> None: def f(): - pass + raise NotImplementedError() source = _pytest._code.Source(f) assert str(source).startswith("def f():") @@ -245,15 +245,15 @@ def test_getline_finally() -> None: def test_getfuncsource_dynamic() -> None: def f(): - raise ValueError + raise NotImplementedError() def g(): - pass + pass # pragma: no cover f_source = _pytest._code.Source(f) g_source = _pytest._code.Source(g) - assert str(f_source).strip() == "def f():\n raise ValueError" - assert str(g_source).strip() == "def g():\n pass" + assert str(f_source).strip() == "def f():\n raise NotImplementedError()" + assert str(g_source).strip() == "def g():\n pass # pragma: no cover" def test_getfuncsource_with_multine_string() -> None: