Compare commits
No commits in common. "1fc1f217609462f6d253cd7830f8c4271be42b1d" and "378c469291c3aeb2755aa92fbdb250e9b3f82143" have entirely different histories.
1fc1f21760
...
378c469291
63
0001-fix-testcase-fail-with-Pytest6-and-Pytest5.patch
Normal file
63
0001-fix-testcase-fail-with-Pytest6-and-Pytest5.patch
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
From 41931fe962963874fc0128a4ef6ff6cf229b0c08 Mon Sep 17 00:00:00 2001
|
||||||
|
From: lyn1001 <thistleslyn@163.com>
|
||||||
|
Date: Wed, 25 Aug 2021 14:23:06 +0800
|
||||||
|
Subject: [PATCH] fix testcase fail with Pytest6 and Pytest5
|
||||||
|
|
||||||
|
---
|
||||||
|
a/src/pytest_forked/__init__.py | 9 ++++++---
|
||||||
|
a/testing/conftest.py | 5 ++++-
|
||||||
|
2 files changed, 10 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/pytest_forked/__init__.py b/src/pytest_forked/__init__.py
|
||||||
|
index 33b09d2..84fb768 100644
|
||||||
|
--- a/src/pytest_forked/__init__.py
|
||||||
|
+++ b/src/pytest_forked/__init__.py
|
||||||
|
@@ -29,12 +29,15 @@ def pytest_addoption(parser):
|
||||||
|
help="box each test run in a separate process (unix)")
|
||||||
|
|
||||||
|
|
||||||
|
-@pytest.mark.tryfirst
|
||||||
|
+@pytest.hookimpl(tryfirst=True)
|
||||||
|
def pytest_runtest_protocol(item):
|
||||||
|
if item.config.getvalue("forked"):
|
||||||
|
+ ihook = item.ihook
|
||||||
|
+ ihook.pytest_runtest_logstart(nodeid=item.nodeid, location=item.location)
|
||||||
|
reports = forked_run_report(item)
|
||||||
|
for rep in reports:
|
||||||
|
- item.ihook.pytest_runtest_logreport(report=rep)
|
||||||
|
+ ihook.pytest_runtest_logreport(report=rep)
|
||||||
|
+ ihook.pytest_runtest_logfinish(nodeid=item.nodeid, location=item.location)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@@ -65,7 +68,7 @@ def forked_run_report(item):
|
||||||
|
|
||||||
|
def report_process_crash(item, result):
|
||||||
|
try:
|
||||||
|
- from _pytest.compat import getfslineno
|
||||||
|
+ from _pytest._code import getfslineno
|
||||||
|
except ImportError:
|
||||||
|
# pytest<4.2
|
||||||
|
path, lineno = item._getfslineno()
|
||||||
|
diff --git a/testing/conftest.py b/testing/conftest.py
|
||||||
|
index 745c00f..c01f73e 100644
|
||||||
|
--- a/testing/conftest.py
|
||||||
|
+++ b/testing/conftest.py
|
||||||
|
@@ -8,10 +8,13 @@ pytest_plugins = "pytester"
|
||||||
|
def _divert_atexit(request, monkeypatch):
|
||||||
|
import atexit
|
||||||
|
atexit_fns = []
|
||||||
|
+
|
||||||
|
+ def atexit_register(func, *args, **kwargs):
|
||||||
|
+ atexit_fns.append(lambda: func(*args, **kwargs))
|
||||||
|
|
||||||
|
def finish():
|
||||||
|
while atexit_fns:
|
||||||
|
atexit_fns.pop()()
|
||||||
|
|
||||||
|
- monkeypatch.setattr(atexit, "register", atexit_fns.append)
|
||||||
|
+ monkeypatch.setattr(atexit, "register", atexit_register)
|
||||||
|
request.addfinalizer(finish)
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
BIN
pytest-forked-1.0.2.tar.gz
Normal file
BIN
pytest-forked-1.0.2.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
@ -1,121 +1,57 @@
|
|||||||
%global _empty_manifest_terminate_build 0
|
%global pypi_name pytest-forked
|
||||||
Name: python-pytest-forked
|
%global desc The pytest-forked plugin extends py.test by adding an option to run tests in\
|
||||||
Version: 1.6.0
|
isolated forked subprocesses. This is useful if you have tests involving C or\
|
||||||
Release: 2
|
C++ libraries that might crash the process. To use the plugin, simply use the\
|
||||||
Summary: run tests in isolated forked subprocesses
|
--forked argument when invoking py.test.
|
||||||
License: MIT
|
|
||||||
URL: https://github.com/pytest-dev/pytest-forked
|
Name: python-%{pypi_name}
|
||||||
Source0: https://files.pythonhosted.org/packages/8c/c9/93ad2ba2413057ee694884b88cf7467a46c50c438977720aeac26e73fdb7/pytest-forked-1.6.0.tar.gz
|
Version: 1.0.2
|
||||||
BuildArch: noarch
|
Release: 2
|
||||||
|
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: 0001-fix-testcase-fail-with-Pytest6-and-Pytest5.patch
|
||||||
|
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: python3-py python3-pytest python3-setuptools_scm
|
||||||
|
|
||||||
%description
|
%description
|
||||||
pytest-forked: run each test in a forked subprocess .. warning:: this is a
|
%{desc}
|
||||||
extraction of the xdist --forked module, future maintenance beyond the bare
|
|
||||||
minimum is not planned until a new maintainer is found. This plugin **does not
|
|
||||||
work on Windows*because there's no fork support. --forked: run each test in a
|
|
||||||
forked subprocess to survive SEGFAULTS or otherwise dying processes.|python|
|
|
||||||
|version| |ci| |pre-commit| |black|.. |versio .. |ci| image:: .
|
|
||||||
|
|
||||||
%package -n python3-pytest-forked
|
%package -n python3-%{pypi_name}
|
||||||
Summary: run tests in isolated forked subprocesses
|
Summary: %{summary}
|
||||||
Provides: python-pytest-forked = %{version}-%{release}
|
%{?python_provide:%python_provide python3-%{pypi_name}}
|
||||||
# Base build requires
|
|
||||||
BuildRequires: python3-devel
|
|
||||||
BuildRequires: python3-setuptools
|
|
||||||
BuildRequires: python3-pbr
|
|
||||||
BuildRequires: python3-pip
|
|
||||||
BuildRequires: python3-wheel
|
|
||||||
# General requires
|
|
||||||
BuildRequires: python3-py
|
|
||||||
BuildRequires: python3-pytest
|
|
||||||
BuildRequires: python3-setuptools_scm
|
|
||||||
# General requires
|
|
||||||
Requires: python3-py
|
|
||||||
Requires: python3-pytest
|
|
||||||
%description -n python3-pytest-forked
|
|
||||||
pytest-forked: run each test in a forked subprocess .. warning:: this is a
|
|
||||||
extraction of the xdist --forked module, future maintenance beyond the bare
|
|
||||||
minimum is not planned until a new maintainer is found. This plugin **does not
|
|
||||||
work on Windows*because there's no fork support. --forked: run each test in a
|
|
||||||
forked subprocess to survive SEGFAULTS or otherwise dying processes.|python|
|
|
||||||
|version| |ci| |pre-commit| |black|.. |versio .. |ci| image:: .
|
|
||||||
|
|
||||||
%package help
|
Requires: python3-py python3-pytest
|
||||||
Summary: Development documents and examples for pytest-forked
|
%description -n python3-%{pypi_name}
|
||||||
Provides: python3-pytest-forked-doc
|
%{desc}
|
||||||
%description help
|
|
||||||
pytest-forked: run each test in a forked subprocess .. warning:: this is a
|
|
||||||
extraction of the xdist --forked module, future maintenance beyond the bare
|
|
||||||
minimum is not planned until a new maintainer is found. This plugin **does not
|
|
||||||
work on Windows*because there's no fork support. --forked: run each test in a
|
|
||||||
forked subprocess to survive SEGFAULTS or otherwise dying processes.|python|
|
|
||||||
|version| |ci| |pre-commit| |black|.. |versio .. |ci| image:: .
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n pytest-forked-%{version}
|
%autosetup -p1 -n %{pypi_name}-%{version}
|
||||||
|
rm -f testing/conftest.pyc
|
||||||
|
rm -rf testing/__pycache__
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%py3_build
|
%py3_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%py3_install
|
%py3_install
|
||||||
install -d -m755 %{buildroot}/%{_pkgdocdir}
|
|
||||||
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
|
|
||||||
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
|
|
||||||
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
|
|
||||||
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
|
|
||||||
if [ -f README.rst ]; then cp -af README.rst %{buildroot}/%{_pkgdocdir}; fi
|
|
||||||
if [ -f README.md ]; then cp -af README.md %{buildroot}/%{_pkgdocdir}; fi
|
|
||||||
if [ -f README.txt ]; then cp -af README.txt %{buildroot}/%{_pkgdocdir}; fi
|
|
||||||
pushd %{buildroot}
|
|
||||||
if [ -d usr/lib ]; then
|
|
||||||
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
|
|
||||||
fi
|
|
||||||
if [ -d usr/lib64 ]; then
|
|
||||||
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
|
|
||||||
fi
|
|
||||||
if [ -d usr/bin ]; then
|
|
||||||
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
|
|
||||||
fi
|
|
||||||
if [ -d usr/sbin ]; then
|
|
||||||
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
|
|
||||||
fi
|
|
||||||
touch doclist.lst
|
|
||||||
if [ -d usr/share/man ]; then
|
|
||||||
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
|
|
||||||
fi
|
|
||||||
popd
|
|
||||||
mv %{buildroot}/filelist.lst .
|
|
||||||
mv %{buildroot}/doclist.lst .
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} testing
|
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} testing
|
||||||
rm -f %{buildroot}%{python3_sitelib}/pytest_forked/__pycache__/__init__.cpython-*-pytest-*.pyc
|
|
||||||
|
|
||||||
%files -n python3-pytest-forked -f filelist.lst
|
%files -n python3-%{pypi_name}
|
||||||
%dir %{python3_sitelib}/*
|
%doc example/boxed.txt README.rst
|
||||||
|
%license LICENSE
|
||||||
%files help -f doclist.lst
|
%{python3_sitelib}/pytest_forked*
|
||||||
%{_docdir}/*
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Sun Jul 23 2023 wangkai <13474090681@163.com> - 1.6.0-2
|
|
||||||
- Fix build error for python3.11
|
|
||||||
|
|
||||||
* Fri Mar 24 2023 wangjunqi <wangjunqi@kylinos.cn> - 1.6.0-1
|
|
||||||
- Update package to version 1.6.0
|
|
||||||
|
|
||||||
* Thu Dec 29 2022 wulei <wulei80@h-partners.com> - 1.4.0-3
|
|
||||||
- Rectify the compilation failure
|
|
||||||
|
|
||||||
* Wed Jun 22 2022 renliang <renliang@uniontech.com> - 1.4.0-2
|
|
||||||
- To modify check, run check
|
|
||||||
|
|
||||||
* Thu May 19 2022 renliang <renliang@uniontech.com> - 1.4.0-1
|
|
||||||
- Upgrade package python3-pytest-forked to version 1.4.0
|
|
||||||
|
|
||||||
* Wed Aug 25 2021 liyanan <liyanan32@huawei.com> - 1.0.2-2
|
* Wed Aug 25 2021 liyanan <liyanan32@huawei.com> - 1.0.2-2
|
||||||
- fix test case fail with Pytest6 and Pytest5
|
- fix test case fail with Pytest6 and Pytest5
|
||||||
|
|
||||||
* Tue Jul 06 2021 wangdi <wangdi@kylinos.cn> - 1.0.2-1
|
* Tue Jul 06 2021 wangdi <wangdi@kylinos.cn> - 1.0.2-1
|
||||||
- Init package for version 1.0.2
|
- Init package for version 1.0.2
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user