From 503049e089f8dda41ae3d68691c2b6a280061eda2106a1f9528950167ae43b5c Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 12 May 2020 22:52:02 +0000 Subject: [PATCH] - Add pytest5-compat.patch to make the test suite compatible with pytest 5.4.0+ (gh#pytest-dev/pytest-forked#32) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-forked?expand=0&rev=7 --- pytest5-compat.patch | 38 ++++++++++++++++++++++++++++++++++++ python-pytest-forked.changes | 6 ++++++ python-pytest-forked.spec | 6 +++++- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 pytest5-compat.patch diff --git a/pytest5-compat.patch b/pytest5-compat.patch new file mode 100644 index 0000000..c399d6f --- /dev/null +++ b/pytest5-compat.patch @@ -0,0 +1,38 @@ +From 1eb5791e005c0d17622c53d5c3158b5b899e147e Mon Sep 17 00:00:00 2001 +From: Stanislav Levin +Date: Thu, 7 May 2020 14:40:19 +0300 +Subject: [PATCH] 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]: https://github.com/pytest-dev/pytest/commit/9c7f1d9b3. + +Fixes: https://github.com/pytest-dev/pytest-forked/issues/30 +Signed-off-by: Stanislav Levin +--- + src/pytest_forked/__init__.py | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/src/pytest_forked/__init__.py b/src/pytest_forked/__init__.py +index fa0600d..886c4c8 100644 +--- a/src/pytest_forked/__init__.py ++++ b/src/pytest_forked/__init__.py +@@ -71,13 +71,8 @@ def runforked(): + + + def report_process_crash(item, result): +- try: +- from _pytest.compat import getfslineno +- except ImportError: +- # pytest<4.2 +- path, lineno = item._getfslineno() +- else: +- path, lineno = getfslineno(item) ++ from _pytest._code.source import getfslineno ++ path, lineno = getfslineno(item) + info = ("%s:%s: running the test CRASHED with signal %d" % + (path, lineno, result.signal)) + from _pytest import runner diff --git a/python-pytest-forked.changes b/python-pytest-forked.changes index afdc170..ce8bcae 100644 --- a/python-pytest-forked.changes +++ b/python-pytest-forked.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue May 12 22:51:08 UTC 2020 - Matej Cepl + +- Add pytest5-compat.patch to make the test suite compatible + with pytest 5.4.0+ (gh#pytest-dev/pytest-forked#32) + ------------------------------------------------------------------- Tue Nov 5 10:56:22 UTC 2019 - Tomáš Chvátal diff --git a/python-pytest-forked.spec b/python-pytest-forked.spec index 9782a65..c987efa 100644 --- a/python-pytest-forked.spec +++ b/python-pytest-forked.spec @@ -1,7 +1,7 @@ # # spec file for package python-pytest-forked # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,6 +24,9 @@ Summary: Run each test in a forked subprocess License: MIT URL: https://github.com/pytest-dev/pytest-forked Source: https://files.pythonhosted.org/packages/source/p/pytest-forked/pytest-forked-%{version}.tar.gz +# PATCH-FIX-UPSTREAM pytest5-compat.patch gh#pytest-dev/pytest-forked#30 mcepl@suse.com +# makes the test suite compatible with pytest5.4.0+ +Patch0: pytest5-compat.patch BuildRequires: %{python_module pytest >= 3.1.0} BuildRequires: %{python_module setuptools_scm} BuildRequires: %{python_module setuptools} @@ -38,6 +41,7 @@ Extraction of pytest-xdist --forked module used for running tests in forked subp %prep %setup -q -n pytest-forked-%{version} +%autopatch -p1 %build %python_build