Skip to content

Commit 1eb5791

Browse files
Add compatibility with Pytest 5.4.0+
'getfslineno' has been removed from 'compat' in Pytest [0]. However, that function was just the wrapper of '_pytest._code.source.getfslineno'. The latter exists in Pytest since, at least, 3.0.0. [0]: pytest-dev/pytest@9c7f1d9b3. Fixes: #30 Signed-off-by: Stanislav Levin <slev@altlinux.org>
1 parent bedbc83 commit 1eb5791

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/pytest_forked/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,8 @@ def runforked():
7171

7272

7373
def report_process_crash(item, result):
74-
try:
75-
from _pytest.compat import getfslineno
76-
except ImportError:
77-
# pytest<4.2
78-
path, lineno = item._getfslineno()
79-
else:
80-
path, lineno = getfslineno(item)
74+
from _pytest._code.source import getfslineno
75+
path, lineno = getfslineno(item)
8176
info = ("%s:%s: running the test CRASHED with signal %d" %
8277
(path, lineno, result.signal))
8378
from _pytest import runner

0 commit comments

Comments
 (0)