Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use modern options configurations for hooks #708

Merged
merged 1 commit into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/708.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use ``@pytest.hookspec`` decorator to declare hook options in ``newhooks.py`` to avoid warnings in ``pytest 7.0``.
8 changes: 4 additions & 4 deletions src/xdist/newhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def pytest_xdist_rsyncfinish(source, gateways):
"""called after rsyncing a directory to remote gateways takes place."""


@pytest.mark.firstresult
@pytest.hookspec(firstresult=True)
def pytest_xdist_getremotemodule():
"""called when creating remote node"""

Expand All @@ -51,12 +51,12 @@ def pytest_xdist_node_collection_finished(node, ids):
"""called by the controller node when a worker node finishes collecting."""


@pytest.mark.firstresult
@pytest.hookspec(firstresult=True)
def pytest_xdist_make_scheduler(config, log):
"""return a node scheduler implementation"""


@pytest.mark.firstresult
@pytest.hookspec(firstresult=True)
def pytest_xdist_auto_num_workers(config):
"""
Return the number of workers to spawn when ``--numprocesses=auto`` is given in the
Expand All @@ -66,7 +66,7 @@ def pytest_xdist_auto_num_workers(config):
"""


@pytest.mark.firstresult
@pytest.hookspec(firstresult=True)
def pytest_handlecrashitem(crashitem, report, sched):
"""
Handle a crashitem, modifying the report if necessary.
Expand Down