Hello community,

here is the log from the commit of package python-pytest-xdist for 
openSUSE:Factory checked in at 2020-09-04 11:03:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-xdist (Old)
 and      /work/SRC/openSUSE:Factory/.python-pytest-xdist.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pytest-xdist"

Fri Sep  4 11:03:09 2020 rev:15 rq:830843 version:2.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pytest-xdist/python-pytest-xdist.changes  
2020-05-28 09:05:37.059392888 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pytest-xdist.new.3399/python-pytest-xdist.changes
        2020-09-04 11:04:14.330788157 +0200
@@ -1,0 +2,27 @@
+Mon Aug 31 13:01:20 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- Update to 2.1.0
+  * New ``pytest_xdist_auto_num_workers`` hook can be implemented by plugins 
+    or ``conftest.py`` files to control the number of workers when 
+    ``--numprocesses=auto`` is given in the command-line.
+  * ``psutil`` has proven to make ``pytest-xdist`` installation in certain 
+    platforms and containers problematic, so to use it for automatic number 
+    of CPUs detection users need to install the ``psutil`` extra
+- Add patches to keep compatibility with older pytests:
+  * reintroduce-slave-terminology.patch
+  * 0001-Revert-Remove-compat-for-pytest-6.patch
+
+-------------------------------------------------------------------
+Tue Aug 25 08:12:22 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- Update to 2.0.0
+  * Drop backward-compatibility "slave" aliases related to worker nodes.  We 
deliberately 
+    moved away from this terminology years ago, and it seems like the right 
time to finish 
+    the deprecation and removal process.
+  * ``pytest-xdist`` no longer supports Python 2.7.
+  * New functions ``xdist.is_xdist_worker``, ``xdist.is_xdist_master``, 
``xdist.get_xdist_worker_id``, 
+    to easily identify the current node.
+  * When using ``-n auto``, count the number of physical CPU cores instead of 
logical ones.
+  * ``pytest-xdist`` now requires ``pytest>=6.0``.
+  
+-------------------------------------------------------------------

Old:
----
  pytest-xdist-1.32.0.tar.gz

New:
----
  0001-Revert-Remove-compat-for-pytest-6.patch
  pytest-xdist-2.1.0.tar.gz
  reintroduce-slave-terminology.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pytest-xdist.spec ++++++
--- /var/tmp/diff_new_pack.u8NOv8/_old  2020-09-04 11:04:19.378790861 +0200
+++ /var/tmp/diff_new_pack.u8NOv8/_new  2020-09-04 11:04:19.382790864 +0200
@@ -17,25 +17,32 @@
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%define skip_python2 1
 Name:           python-pytest-xdist
-Version:        1.32.0
+Version:        2.1.0
 Release:        0
 Summary:        Distributed testing and loop-on-failing for py.test
 License:        MIT
 URL:            https://github.com/pytest-dev/pytest-xdist
 Source0:        
https://files.pythonhosted.org/packages/source/p/pytest-xdist/pytest-xdist-%{version}.tar.gz
+# This is actually revert of something upstream wanted to do a long time ago, 
but was waiting for the rest of pytest to sync with them.
+# It is only a terminology change, but one that has personal meaning for many 
people. On the other hand, it was breaking compatibility with pytest < 6.
+# In my opinion it would be inadequate to send this patch upstream.
+Patch0:         reintroduce-slave-terminology.patch
+# minor compatibility revert
+Patch1:         0001-Revert-Remove-compat-for-pytest-6.patch
 BuildRequires:  %{python_module execnet >= 1.1}
 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 six}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 Requires:       python-execnet >= 1.1
 Requires:       python-pytest >= 4.4.0
 Requires:       python-pytest-forked
-Requires:       python-six
+Suggests:       python-psutil >= 3.0.0
 BuildArch:      noarch
 %python_subpackages
 
@@ -65,6 +72,7 @@
 
 %prep
 %setup -q -n pytest-xdist-%{version}
+%autopatch -p1
 sed -i 's/\r//' README.rst
 
 %build
@@ -78,7 +86,7 @@
 %pytest
 
 %files %{python_files}
-%doc CHANGELOG.rst ISSUES.txt README.rst
+%doc CHANGELOG.rst README.rst
 %license LICENSE
 %{python_sitelib}/xdist
 %{python_sitelib}/pytest_xdist-%{version}-py%{python_version}.egg-info

++++++ 0001-Revert-Remove-compat-for-pytest-6.patch ++++++
>From 9e81d88e5e9ac12cebc9848466560489b3064982 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mark=C3=A9ta=20Cal=C3=A1bkov=C3=A1?=
 <[email protected]>
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
@@ -11,6 +11,7 @@ import os
 import time
 
 import py
+import _pytest.hookspec
 import pytest
 from execnet.gateway_base import dumps, DumpError
 
@@ -100,8 +101,11 @@ class WorkerInteractor:
     def pytest_runtest_logstart(self, nodeid, location):
         self.sendevent("logstart", nodeid=nodeid, location=location)
 
-    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"):
+
+        def pytest_runtest_logfinish(self, nodeid, location):
+            self.sendevent("logfinish", nodeid=nodeid, location=location)
 
     def pytest_runtest_logreport(self, report):
         data = self.config.hook.pytest_report_to_serializable(
@@ -121,14 +125,29 @@ class WorkerInteractor:
             )
             self.sendevent("collectreport", data=data)
 
-    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"):
+
+        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"):
+
+        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):
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:
         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()
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):
             r"""
             \[(gw\d)\]  # worker
             \s*
-            (?:\[\s*\d+%\])? # progress indicator
+            (?:\[\s*\d+%\])? # progress indicator (pytest >=3.3)
             \s(.*?)     # status string ("PASSED")
             \s(.*::.*)  # nodeid
         """,
-- 
2.28.0

++++++ pytest-xdist-1.32.0.tar.gz -> pytest-xdist-2.1.0.tar.gz ++++++
++++ 2496 lines of diff (skipped)

++++++ reintroduce-slave-terminology.patch ++++++
>From ae74dc2172d7f633d2e52d30aec79fbb0ae9ed63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mark=C3=A9ta=20Cal=C3=A1bkov=C3=A1?=
 <[email protected]>
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
 
-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:
         node.workerinfo["id"] = node.gateway.id
         node.workerinfo["spec"] = node.gateway.spec
 
+        # TODO: (#234 task) needs this for pytest. Remove when refactor in 
pytest repo
+        node.slaveinfo = node.workerinfo
+
         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):
     )
     group.addoption(
         "--max-worker-restart",
+        "--max-slave-restart",
         action="store",
         default=None,
         dest="maxworkerrestart",
         help="maximum number of workers that can be restarted "
-        "when crashed (set to zero to disable this feature)",
+        "when crashed (set to zero to disable this feature)\n"
+        "'--max-slave-restart' option is deprecated and will be removed in "
+        "a future release",
     )
     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__":
     config._parser.prog = os.path.basename(workerinput["mainargv"][0])
     config.workerinput = workerinput
     config.workeroutput = {}
+    # TODO: deprecated name, backward compatibility only. Remove it in future
+    config.slaveinput = config.workerinput
+    config.slaveoutput = config.workeroutput
     interactor = WorkerInteractor(config, channel)
     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
@@ -225,9 +225,13 @@ class WorkerController:
         self.workerinput = {
             "workerid": gateway.id,
             "workercount": len(nodemanager.specs),
+            "slaveid": gateway.id,
+            "slavecount": len(nodemanager.specs),
             "testrunuid": nodemanager.testrunuid,
             "mainargv": sys.argv,
         }
+        # TODO: deprecated name, backward compatibility only. Remove it in 
future
+        self.slaveinput = self.workerinput
         self._down = False
         self._shutdown_sent = False
         self.log = py.log.Producer("workerctl-%s" % gateway.id)
@@ -326,7 +330,7 @@ class WorkerController:
                 self.notify_inproc(eventname, node=self, **kwargs)
             elif eventname == "workerfinished":
                 self._down = True
-                self.workeroutput = kwargs["workeroutput"]
+                self.workeroutput = self.slaveoutput = kwargs["workeroutput"]
                 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:
         result.stderr.fnmatch_lines(["--foobar=123 active! *"])
         assert dest.join(subdir.basename).check(dir=1)
 
+    def test_backward_compatibility_worker_terminology(self, testdir):
+        """Ensure that we still support "config.slaveinput" for backward 
compatibility (#234).
+
+        Keep in mind that removing this compatibility will break a ton of 
plugins and user code.
+        """
+        testdir.makepyfile(
+            """
+            def test(pytestconfig):
+                assert hasattr(pytestconfig, 'slaveinput')
+                assert hasattr(pytestconfig, 'workerinput')
+        """
+        )
+        result = testdir.runpytest("-n1")
+        result.stdout.fnmatch_lines("*1 passed*")
+        assert result.ret == 0
+
     def test_data_exchange(self, testdir):
         testdir.makeconftest(
             """
-- 
2.28.0


Reply via email to