diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index 199b8716f..b83ad93e2 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -59,9 +59,9 @@ def test_excinfo_getstatement(): except ValueError: excinfo = _pytest._code.ExceptionInfo.from_current() linenumbers = [ - _pytest._code.getrawcode(f).co_firstlineno - 1 + 4, - _pytest._code.getrawcode(f).co_firstlineno - 1 + 1, - _pytest._code.getrawcode(g).co_firstlineno - 1 + 1, + f.__code__.co_firstlineno - 1 + 4, + f.__code__.co_firstlineno - 1 + 1, + g.__code__.co_firstlineno - 1 + 1, ] values = list(excinfo.traceback) foundlinenumbers = [x.lineno for x in values] diff --git a/testing/code/test_source.py b/testing/code/test_source.py index 5e7e1abf5..519344dd4 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -478,7 +478,7 @@ def test_getfslineno(): fspath, lineno = getfslineno(f) assert fspath.basename == "test_source.py" - assert lineno == _pytest._code.getrawcode(f).co_firstlineno - 1 # see findsource + assert lineno == f.__code__.co_firstlineno - 1 # see findsource class A: pass