forked from pool/python-pytest-xdist
- 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
OBS-URL: https://build.opensuse.org/request/show/946700
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-xdist?expand=0&rev=26
109 lines
4.1 KiB
Diff
109 lines
4.1 KiB
Diff
From 9e81d88e5e9ac12cebc9848466560489b3064982 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Mark=C3=A9ta=20Cal=C3=A1bkov=C3=A1?=
|
|
<meggy.calabkova@gmail.com>
|
|
Date: Mon, 31 Aug 2020 15:50:54 +0200
|
|
Subject: [PATCH] Revert "Remove compat for pytest < 6"
|
|
|
|
This reverts commit d153e0a4c4b764c821da9907ba3d2cac31bc3884.
|
|
|
|
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
|
|
|
|
import py
|
|
+import _pytest.hookspec
|
|
import pytest
|
|
from execnet.gateway_base import dumps, DumpError
|
|
|
|
@@ -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):
|
|
@@ -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",
|
|
- warning_message_data=serialize_warning_message(warning_message),
|
|
- when=when,
|
|
- nodeid=nodeid,
|
|
- location=location,
|
|
- )
|
|
+ # 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",
|
|
+ warning_message_data=serialize_warning_message(warning_message),
|
|
+ when=when,
|
|
+ nodeid=nodeid,
|
|
+ location=location,
|
|
+ )
|
|
+
|
|
+ # 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",
|
|
+ warning_message_data=serialize_warning_message(warning_message),
|
|
+ when=when,
|
|
+ # item cannot be serialized and will always be None when used with xdist
|
|
+ item=None,
|
|
+ )
|
|
|
|
|
|
def serialize_warning_message(warning_message):
|
|
--- 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
|
|
|
|
- excinfo = ExceptionInfo.from_current()
|
|
+ # ExceptionInfo API changed in pytest 4.1
|
|
+ if hasattr(ExceptionInfo, "from_current"):
|
|
+ excinfo = ExceptionInfo.from_current()
|
|
+ else:
|
|
+ excinfo = ExceptionInfo()
|
|
print("!" * 20, excinfo)
|
|
self.config.notify_exception(excinfo)
|
|
self.shutdown()
|
|
--- 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*
|
|
- (?:\[\s*\d+%\])? # progress indicator
|
|
+ (?:\[\s*\d+%\])? # progress indicator (pytest >=3.3)
|
|
\s(.*?) # status string ("PASSED")
|
|
\s(.*::.*) # nodeid
|
|
""",
|