Skip to content

Commit

Permalink
pytest-xdist 2.0 compatibility
Browse files Browse the repository at this point in the history
The "slave-" attributes are removed after a period of deprecation in favor of "worker-" attributes.
  • Loading branch information
Zac-HD committed Jun 23, 2020
1 parent fe6631f commit 02927e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Imran Mumtaz
Jim Brännlund
Sam Clements
Tomas Krizek
Zac Hatfield-Dodds
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release Notes
-------------

* Compatible with ``pytest-xdist`` 1.22.3+, now including 2.0+

* Thanks to `@Zac-HD <https://github.com/Zac-HD>`_ for the PR

1.9.0 (2020-04-03)
------------------

Expand Down
12 changes: 6 additions & 6 deletions pytest_metadata/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def pytest_configure(config):
if os.environ.get(var)
]

if hasattr(config, "slaveoutput"):
config.slaveoutput["metadata"] = config._metadata
if hasattr(config, "workeroutput"):
config.workeroutput["metadata"] = config._metadata

config.hook.pytest_metadata(metadata=config._metadata)

Expand All @@ -106,7 +106,7 @@ def pytest_report_header(config):

@pytest.mark.optionalhook
def pytest_testnodedown(node):
# note that any metadata from remote slaves will be replaced with the
# environment from the final slave to quit
if hasattr(node, "slaveoutput"):
node.config._metadata.update(node.slaveoutput["metadata"])
# note that any metadata from remote workers will be replaced with the
# environment from the final worker to quit
if hasattr(node, "workeroutput"):
node.config._metadata.update(node.workeroutput["metadata"])

0 comments on commit 02927e9

Please sign in to comment.