Accepting request 803983 from devel:languages:python:pytest

- 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/request/show/803983
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-forked?expand=0&rev=4
This commit is contained in:
Yuchen Lin 2020-05-28 07:05:25 +00:00 committed by Git OBS Bridge
commit 560dd39908
3 changed files with 49 additions and 1 deletions

38
pytest5-compat.patch Normal file
View File

@ -0,0 +1,38 @@
From 1eb5791e005c0d17622c53d5c3158b5b899e147e Mon Sep 17 00:00:00 2001
From: Stanislav Levin <slev@altlinux.org>
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 <slev@altlinux.org>
---
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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue May 12 22:51:08 UTC 2020 - Matej Cepl <mcepl@suse.com>
- 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 <tchvatal@suse.com>

View File

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