diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e302e06..e9d54a2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,26 @@ +pytest-xdist 2.5.0 (2021-12-10) +=============================== + +Features +-------- + +- `#722 `_: Full compatibility with pytest 7 - no deprecation warnings or use of legacy features. + +- `#733 `_: 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 +--------------- + +- `#708 `_: Use ``@pytest.hookspec`` decorator to declare hook options in ``newhooks.py`` to avoid warnings in ``pytest 7.0``. + +- `#719 `_: Use up-to-date ``setup.cfg``/``pyproject.toml`` packaging setup. + +- `#720 `_: Require pytest>=6.2.0. + +- `#721 `_: Started using type annotations and mypy checking internally. The types are incomplete and not published. + + pytest-xdist 2.4.0 (2021-09-20) =============================== diff --git a/changelog/708.trivial.rst b/changelog/708.trivial.rst deleted file mode 100644 index 38b4176..0000000 --- a/changelog/708.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Use ``@pytest.hookspec`` decorator to declare hook options in ``newhooks.py`` to avoid warnings in ``pytest 7.0``. diff --git a/changelog/719.trivial.rst b/changelog/719.trivial.rst deleted file mode 100644 index 8fdb3b6..0000000 --- a/changelog/719.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Use up-to-date ``setup.cfg``/``pyproject.toml`` packaging setup. diff --git a/changelog/720.trivial.rst b/changelog/720.trivial.rst deleted file mode 100644 index ee671cb..0000000 --- a/changelog/720.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Require pytest>=6.2.0. diff --git a/changelog/721.trivial.rst b/changelog/721.trivial.rst deleted file mode 100644 index 1c32376..0000000 --- a/changelog/721.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Started using type annotations and mypy checking internally. The types are incomplete and not published. diff --git a/changelog/722.feature.rst b/changelog/722.feature.rst deleted file mode 100644 index b8654ff..0000000 --- a/changelog/722.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Full compatibility with pytest 7 - no deprecation warnings or use of legacy features. diff --git a/changelog/733.feature.rst b/changelog/733.feature.rst deleted file mode 100644 index 28163e7..0000000 --- a/changelog/733.feature.rst +++ /dev/null @@ -1 +0,0 @@ -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``. diff --git a/src/xdist/dsession.py b/src/xdist/dsession.py index eb5ae75..2ae3db6 100644 --- a/src/xdist/dsession.py +++ b/src/xdist/dsession.py @@ -294,6 +294,8 @@ class DSession: def worker_warning_captured(self, warning_message, when, item): """Emitted when a node calls the pytest_warning_captured hook (deprecated in 6.0).""" + # This hook as been removed in pytest 7.1, and we can remove support once we only + # support pytest >=7.1. kwargs = dict(warning_message=warning_message, when=when, item=item) self.config.hook.pytest_warning_captured.call_historic(kwargs=kwargs) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index c139197..dee1848 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -447,11 +447,6 @@ class TestTerminalReporting: def test_logfinish_hook(self, pytester: pytest.Pytester) -> None: """Ensure the pytest_runtest_logfinish hook is being properly handled""" - from _pytest import hookspec - - if not hasattr(hookspec, "pytest_runtest_logfinish"): - pytest.skip("test requires pytest_runtest_logfinish hook in pytest (3.4+)") - pytester.makeconftest( """ def pytest_runtest_logfinish(): @@ -773,6 +768,13 @@ class TestWarnings: """ Do not trigger the deprecated pytest_warning_captured hook in pytest 6+ (#562) """ + from _pytest import hookspec + + if not hasattr(hookspec, "pytest_warning_captured"): + pytest.skip( + f"pytest {pytest.__version__} does not have the pytest_warning_captured hook." + ) + pytester.makeconftest( """ def pytest_warning_captured(warning_message):