From d2fcd304d714614db5922e9e62884bf99d2ea420 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: May 29 2020 20:17:29 +0000 Subject: Fix pytest 5 compatibility --- diff --git a/fix-pytest5-compatibility.patch b/fix-pytest5-compatibility.patch new file mode 100644 index 0000000..9b10c3b --- /dev/null +++ b/fix-pytest5-compatibility.patch @@ -0,0 +1,20 @@ +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 forked_run_report(item): + + + 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.spec b/python-pytest-forked.spec index d44d0a8..d8e57a9 100644 --- a/python-pytest-forked.spec +++ b/python-pytest-forked.spec @@ -6,13 +6,16 @@ C++ libraries that might crash the process. To use the plugin, simply use the\ Name: python-%{pypi_name} Version: 1.1.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: py.test plugin for running tests in isolated forked subprocesses License: MIT URL: https://github.com/pytest-dev/pytest-forked Source0: https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch +# Fix pytest 5 compatibility +# From upstream PR: https://github.com/pytest-dev/pytest-forked/pull/32 +Patch0: fix-pytest5-compatibility.patch BuildRequires: python3-devel BuildRequires: python3-py python3-pytest python3-setuptools_scm @@ -29,7 +32,7 @@ Requires: python3-py %{desc} %prep -%autosetup -n %{pypi_name}-%{version} +%autosetup -n %{pypi_name}-%{version} -p1 rm -f testing/conftest.pyc rm -rf testing/__pycache__ @@ -49,6 +52,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} testing %{python3_sitelib}/pytest_forked* %changelog +* Fri May 29 2020 Charalampos Stratakis - 1.1.1-5 +- Fix pytest 5 compatibility + * Fri May 29 2020 Charalampos Stratakis - 1.1.1-4 - Drop manual requires on python3-pytest to support usage with pytest4 compat package