Skip to content

Commit c7c7f9e

Browse files
committed
Use modern options configurations for hooks
Noticed while reviewing pytest-dev/pytest#9118
1 parent 56275d4 commit c7c7f9e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

changelog/708.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use ``@pytest.hookspec`` decorator to declare hook options in ``newhooks.py`` to avoid warnings in ``pytest 7.0``.

src/xdist/newhooks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def pytest_xdist_rsyncfinish(source, gateways):
3030
"""called after rsyncing a directory to remote gateways takes place."""
3131

3232

33-
@pytest.mark.firstresult
33+
@pytest.hookspec(firstresult=True)
3434
def pytest_xdist_getremotemodule():
3535
"""called when creating remote node"""
3636

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

5353

54-
@pytest.mark.firstresult
54+
@pytest.hookspec(firstresult=True)
5555
def pytest_xdist_make_scheduler(config, log):
5656
"""return a node scheduler implementation"""
5757

5858

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

6868

69-
@pytest.mark.firstresult
69+
@pytest.hookspec(firstresult=True)
7070
def pytest_handlecrashitem(crashitem, report, sched):
7171
"""
7272
Handle a crashitem, modifying the report if necessary.

0 commit comments

Comments
 (0)