Accepting request 946881 from devel:languages:python:pytest

OBS-URL: https://build.opensuse.org/request/show/946881
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-xdist?expand=0&rev=18
This commit is contained in:
Dominique Leuenberger 2022-01-23 15:25:38 +00:00 committed by Git OBS Bridge
commit 4c64a2470b
6 changed files with 115 additions and 97 deletions

View File

@ -5,16 +5,16 @@ Date: Mon, 31 Aug 2020 15:50:54 +0200
Subject: [PATCH] Revert "Remove compat for pytest < 6"
This reverts commit d153e0a4c4b764c821da9907ba3d2cac31bc3884.
---
src/xdist/remote.py | 39 ++++++++++++++++++++++++++++----------
src/xdist/workermanage.py | 6 +++++-
testing/acceptance_test.py | 2 +-
3 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/src/xdist/remote.py b/src/xdist/remote.py
index 26cf958..b78d744 100644
--- a/src/xdist/remote.py
+++ b/src/xdist/remote.py
Updated on 2022-01-15
---
src/xdist/remote.py | 44 ++++++++++++++++++++++++++++++++------------
src/xdist/workermanage.py | 6 +++++-
testing/acceptance_test.py | 2 +-
3 files changed, 38 insertions(+), 14 deletions(-)
--- a/src/xdist/remote.py 2022-01-15 19:11:37.443540560 +0100
+++ b/src/xdist/remote.py 2022-01-15 19:18:58.911532654 +0100
@@ -11,6 +11,7 @@ import os
import time
@ -23,24 +23,27 @@ index 26cf958..b78d744 100644
import pytest
from execnet.gateway_base import dumps, DumpError
@@ -100,8 +101,11 @@ class WorkerInteractor:
@@ -147,9 +148,12 @@ class WorkerInteractor:
def pytest_runtest_logstart(self, nodeid, location):
self.sendevent("logstart", nodeid=nodeid, location=location)
- @pytest.hookimpl
- def pytest_runtest_logfinish(self, nodeid, location):
- self.sendevent("logfinish", nodeid=nodeid, location=location)
+ # the pytest_runtest_logfinish hook was introduced in pytest 3.4
+ if hasattr(_pytest.hookspec, "pytest_runtest_logfinish"):
+
+ @pytest.hookimpl
+ def pytest_runtest_logfinish(self, nodeid, location):
+ self.sendevent("logfinish", nodeid=nodeid, location=location)
@pytest.hookimpl
def pytest_runtest_logreport(self, report):
data = self.config.hook.pytest_report_to_serializable(
@@ -121,14 +125,29 @@ class WorkerInteractor:
@@ -171,15 +175,31 @@ class WorkerInteractor:
)
self.sendevent("collectreport", data=data)
- @pytest.hookimpl
- def pytest_warning_recorded(self, warning_message, when, nodeid, location):
- self.sendevent(
- "warning_recorded",
@ -52,6 +55,7 @@ index 26cf958..b78d744 100644
+ # the pytest_warning_recorded hook was introduced in pytest 6.0
+ if hasattr(_pytest.hookspec, "pytest_warning_recorded"):
+
+ @pytest.hookimpl
+ def pytest_warning_recorded(self, warning_message, when, nodeid, location):
+ self.sendevent(
+ "warning_recorded",
@ -64,6 +68,7 @@ index 26cf958..b78d744 100644
+ # the pytest_warning_captured hook was introduced in pytest 3.8
+ elif hasattr(_pytest.hookspec, "pytest_warning_captured"):
+
+ @pytest.hookimpl
+ def pytest_warning_captured(self, warning_message, when, item):
+ self.sendevent(
+ "warning_captured",
@ -75,11 +80,9 @@ index 26cf958..b78d744 100644
def serialize_warning_message(warning_message):
diff --git a/src/xdist/workermanage.py b/src/xdist/workermanage.py
index 9b00251..141d86a 100644
--- a/src/xdist/workermanage.py
+++ b/src/xdist/workermanage.py
@@ -383,7 +383,11 @@ class WorkerController:
--- a/src/xdist/workermanage.py 2022-01-15 19:11:37.443540560 +0100
+++ b/src/xdist/workermanage.py 2022-01-15 19:11:59.967540157 +0100
@@ -386,7 +386,11 @@ class WorkerController:
except: # noqa
from _pytest._code import ExceptionInfo
@ -92,11 +95,9 @@ index 9b00251..141d86a 100644
print("!" * 20, excinfo)
self.config.notify_exception(excinfo)
self.shutdown()
diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py
index 8cac669..eee794c 100644
--- a/testing/acceptance_test.py
+++ b/testing/acceptance_test.py
@@ -1364,7 +1364,7 @@ def parse_tests_and_workers_from_output(lines):
--- a/testing/acceptance_test.py 2022-01-15 19:11:37.463540560 +0100
+++ b/testing/acceptance_test.py 2022-01-15 19:11:59.967540157 +0100
@@ -1530,7 +1530,7 @@ def parse_tests_and_workers_from_output(
r"""
\[(gw\d)\] # worker
\s*
@ -105,6 +106,3 @@ index 8cac669..eee794c 100644
\s(.*?) # status string ("PASSED")
\s(.*::.*) # nodeid
""",
--
2.28.0

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1d8edbb1a45e8e1f8e44b1260583107fc23f8bc8da6d18cb331ff61d41258ecf
size 64781

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4580deca3ff04ddb2ac53eba39d76cb5dd5edeac050cb6fbc768b0dd712b4edf
size 72455

View File

@ -1,3 +1,47 @@
-------------------------------------------------------------------
Sat Jan 15 18:31:01 UTC 2022 - Matthias Fehring <buschmann23@opensuse.org>
- Update to 2.5.0
* Features
+ Full compatibility with pytest 7 - no deprecation warnings or
use of legacy features.
+ New --dist=loadgroup option, which ensures all tests marked
with @pytest.mark.xdist_group run in the same session/worker.
Other tests run distributed as in --dist=load.
* Trivial Changes
+ Use @pytest.hookspec decorator to declare hook options in
newhooks.py to avoid warnings in pytest 7.0.
+ Use up-to-date setup.cfg/pyproject.toml packaging setup.
+ Started using type annotations and mypy checking internally.
The types are incomplete and not published.
- Changes from 2.4.0
* Features
+ On Linux, the process title now changes to indicate the current
worker state (running/idle). Depends on the setproctitle package,
which can be installed with pip install pytest-xdist[setproctitle].
+ Add support for Python 3.10.
- Changes from 2.3.0
* Deprecations and Removals
+ Python 3.5 is no longer supported.
* Features
+ Add --numprocesses=logical flag, which automatically uses the
number of logical CPUs available, instead of physical CPUs
with auto. This is very useful for test suites which are not
CPU-bound.
+ Added new pytest_handlecrashitem hook to allow handling and
rescheduling crashed items.
* Bug Fixes
+ Copy the parent process sys.path into local workers, to work
around execnet's python -c adding the current directory to sys.path.
+ Fix issue caused by changing the branch name of the pytest repository.
* Trivial Changes
+ Replace master with controller where ever possible.
+ Use 'main' to refer to pytest default branch in tox env names.
- Update patches
* reintroduce-slave-terminology.patch
* 0001-Revert-Remove-compat-for-pytest-6.patch
- Require setuptools_scm >= 6.0 for building
-------------------------------------------------------------------
Tue Feb 2 09:53:19 UTC 2021 - Dirk Müller <dmueller@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-pytest-xdist
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-pytest-xdist
Version: 2.2.0
Version: 2.5.0
Release: 0
Summary: Distributed testing and loop-on-failing for py.test
License: MIT
@ -36,7 +36,7 @@ BuildRequires: %{python_module filelock}
BuildRequires: %{python_module psutil >= 3.0.0}
BuildRequires: %{python_module pytest >= 4.4.0}
BuildRequires: %{python_module pytest-forked}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools_scm >= 6.0}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-execnet >= 1.1

View File

@ -5,45 +5,32 @@ Date: Mon, 31 Aug 2020 15:26:22 +0200
Subject: [PATCH] Revert "Finish removal of "slave" terminology"
This reverts commit de3e54fd278d49b9b5d64e64f5942512519545e5.
---
.appveyor.yml | 1 +
.travis.yml | 2 ++
setup.py | 10 ++++++----
src/xdist/dsession.py | 3 +++
src/xdist/plugin.py | 5 ++++-
src/xdist/remote.py | 3 +++
src/xdist/workermanage.py | 6 +++++-
testing/acceptance_test.py | 16 ++++++++++++++++
tox.ini | 4 ++++
9 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/setup.py b/setup.py
index b6fb0f1..560069c 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
Updated on 2022-01-15
---
setup.cfg | 2 +-
src/xdist/dsession.py | 3 +++
src/xdist/plugin.py | 5 ++++-
src/xdist/remote.py | 3 +++
src/xdist/workermanage.py | 6 +++++-
testing/acceptance_test.py | 16 ++++++++++++++++
6 files changed, 32 insertions(+), 3 deletions(-)
--- a/setup.cfg 2021-12-10 12:41:52.000000000 +0100
+++ b/setup.cfg 2022-01-15 18:37:44.047576974 +0100
@@ -38,7 +38,7 @@ zip_safe = False
python_requires = >=3.6
install_requires =
execnet>=1.1
- pytest>=6.2.0
+ pytest>=4.4.0
pytest-forked
setup_requires = setuptools_scm>=6.0
-install_requires = ["execnet>=1.1", "pytest>=6.0.0", "pytest-forked"]
+install_requires = ["execnet>=1.1", "pytest>=4.4.0", "pytest-forked"]
with open("README.rst") as f:
@@ -9,7 +9,8 @@ with open("README.rst") as f:
setup(
name="pytest-xdist",
use_scm_version={"write_to": "src/xdist/_version.py"},
- description="pytest xdist plugin for distributed testing and loop-on-failing modes",
+ description="pytest xdist plugin for distributed testing"
+ " and loop-on-failing modes",
long_description=long_description,
license="MIT",
author="holger krekel and contributors",
diff --git a/src/xdist/dsession.py b/src/xdist/dsession.py
index 07ef091..80edd9b 100644
--- a/src/xdist/dsession.py
+++ b/src/xdist/dsession.py
@@ -150,6 +150,9 @@ class DSession:
--- a/src/xdist/dsession.py 2021-12-10 12:41:44.000000000 +0100
+++ b/src/xdist/dsession.py 2022-01-15 18:39:21.407575231 +0100
@@ -155,6 +155,9 @@ class DSession:
node.workerinfo["id"] = node.gateway.id
node.workerinfo["spec"] = node.gateway.spec
@ -53,11 +40,9 @@ index 07ef091..80edd9b 100644
self.config.hook.pytest_testnodeready(node=node)
if self.shuttingdown:
node.shutdown()
diff --git a/src/xdist/plugin.py b/src/xdist/plugin.py
index 2d8424d..f497603 100644
--- a/src/xdist/plugin.py
+++ b/src/xdist/plugin.py
@@ -65,11 +65,14 @@ def pytest_addoption(parser):
--- a/src/xdist/plugin.py 2021-12-10 12:41:44.000000000 +0100
+++ b/src/xdist/plugin.py 2022-01-15 18:40:33.771573935 +0100
@@ -76,11 +76,14 @@ def pytest_addoption(parser):
)
group.addoption(
"--max-worker-restart",
@ -73,23 +58,19 @@ index 2d8424d..f497603 100644
)
group.addoption(
"--dist",
diff --git a/src/xdist/remote.py b/src/xdist/remote.py
index 97dc180..26cf958 100644
--- a/src/xdist/remote.py
+++ b/src/xdist/remote.py
@@ -233,5 +233,8 @@ if __name__ == "__channelexec__":
--- a/src/xdist/remote.py 2021-12-10 12:41:44.000000000 +0100
+++ b/src/xdist/remote.py 2022-01-15 18:41:44.115572675 +0100
@@ -287,5 +287,8 @@ if __name__ == "__channelexec__":
config._parser.prog = os.path.basename(workerinput["mainargv"][0])
config.workerinput = workerinput
config.workeroutput = {}
config.workerinput = workerinput # type: ignore[attr-defined]
config.workeroutput = {} # type: ignore[attr-defined]
+ # TODO: deprecated name, backward compatibility only. Remove it in future
+ config.slaveinput = config.workerinput
+ config.slaveoutput = config.workeroutput
interactor = WorkerInteractor(config, channel)
interactor = WorkerInteractor(config, channel) # type: ignore[name-defined]
config.hook.pytest_cmdline_main(config=config)
diff --git a/src/xdist/workermanage.py b/src/xdist/workermanage.py
index dfcb59b..9b00251 100644
--- a/src/xdist/workermanage.py
+++ b/src/xdist/workermanage.py
--- a/src/xdist/workermanage.py 2021-12-10 12:41:44.000000000 +0100
+++ b/src/xdist/workermanage.py 2022-01-15 18:43:34.595570697 +0100
@@ -225,9 +225,13 @@ class WorkerController:
self.workerinput = {
"workerid": gateway.id,
@ -104,7 +85,7 @@ index dfcb59b..9b00251 100644
self._down = False
self._shutdown_sent = False
self.log = py.log.Producer("workerctl-%s" % gateway.id)
@@ -326,7 +330,7 @@ class WorkerController:
@@ -329,7 +333,7 @@ class WorkerController:
self.notify_inproc(eventname, node=self, **kwargs)
elif eventname == "workerfinished":
self._down = True
@ -113,13 +94,11 @@ index dfcb59b..9b00251 100644
self.notify_inproc("workerfinished", node=self)
elif eventname in ("logstart", "logfinish"):
self.notify_inproc(eventname, node=self, **kwargs)
diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py
index 48ed35f..8cac669 100644
--- a/testing/acceptance_test.py
+++ b/testing/acceptance_test.py
@@ -241,6 +241,22 @@ class TestDistribution:
--- a/testing/acceptance_test.py 2021-12-10 12:41:44.000000000 +0100
+++ b/testing/acceptance_test.py 2022-01-15 18:44:54.711569262 +0100
@@ -247,6 +247,22 @@ class TestDistribution:
result.stderr.fnmatch_lines(["--foobar=123 active! *"])
assert dest.join(subdir.basename).check(dir=1)
assert dest.joinpath(subdir.name).is_dir()
+ def test_backward_compatibility_worker_terminology(self, testdir):
+ """Ensure that we still support "config.slaveinput" for backward compatibility (#234).
@ -137,9 +116,6 @@ index 48ed35f..8cac669 100644
+ result.stdout.fnmatch_lines("*1 passed*")
+ assert result.ret == 0
+
def test_data_exchange(self, testdir):
testdir.makeconftest(
def test_data_exchange(self, pytester: pytest.Pytester) -> None:
pytester.makeconftest(
"""
--
2.28.0