Init package for version 1.0.2

This commit is contained in:
wangdi 2021-07-06 15:58:34 +08:00
parent 7d36c1e13b
commit 146678eca1
3 changed files with 92 additions and 0 deletions

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

BIN
pytest-forked-1.0.2.tar.gz Normal file

Binary file not shown.

54
python-pytest-forked.spec Normal file
View File

@ -0,0 +1,54 @@
%global pypi_name pytest-forked
%global desc The pytest-forked plugin extends py.test by adding an option to run tests in\
isolated forked subprocesses. This is useful if you have tests involving C or\
C++ libraries that might crash the process. To use the plugin, simply use the\
--forked argument when invoking py.test.
Name: python-%{pypi_name}
Version: 1.0.2
Release: 1
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
Patch1: add-compatibility-with-Pytest-5.4.0.patch
BuildRequires: python3-devel
BuildRequires: python3-py python3-pytest python3-setuptools_scm
%description
%{desc}
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
Requires: python3-py python3-pytest
%description -n python3-%{pypi_name}
%{desc}
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
rm -f testing/conftest.pyc
rm -rf testing/__pycache__
%build
%py3_build
%install
%py3_install
%check
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} testing
%files -n python3-%{pypi_name}
%doc example/boxed.txt README.rst
%license LICENSE
%{python3_sitelib}/pytest_forked*
%changelog
* Tue Jul 06 2021 wangdi <wangdi@kylinos.cn> - 1.0.2-1
- Init package for version 1.0.2