Remove unneeded getrawcode() calls from tests

This commit is contained in:
Ran Benita 2019-11-15 15:54:56 +02:00
parent 04d68fbc9e
commit 5bfe793fd5
2 changed files with 4 additions and 4 deletions

View File

@ -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]

View File

@ -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