Skip to content

Commit

Permalink
Ensure compat with xdist 2.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jun 17, 2020
1 parent e06fec1 commit 2d0ba47
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ These people have contributed to `pytest-cloud`, in alphabetical order:
* `Loic Dachary <loic@dachary.org>`_
* `Michael Overmeyer <movermeyer@github.com>`_
* `Orthographic Pedant <orthographic-pedant@github.com>`_
* `Zac Hatfield-Dodds <zac@zhd.dev>`_
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

4.0.1
-----

- Compatible with pytest-xdist >= 1.26.0 *including* 2.0.0+

4.0.0
-----

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Install pytest-cloud
Features
--------

The plugin provides an easy way of running tests among several test nodes (slaves).
The plugin provides an easy way of running tests among several test nodes (workers).
Uses the great pytest-xdist_ plugin for actual distributed run.
When used, it will automatically detect capabilites of given node(s) and run only the number of test processes it is
able to handle. If will also filter out offline nodes or nodes which were failed to respond to the
Expand Down
6 changes: 3 additions & 3 deletions pytest_cloud/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def activate_env(channel, virtualenv_path, develop_eggs=None):


def setup(self):
"""Set up a new test slave."""
self.log("setting up slave session")
"""Set up a new test worker."""
self.log("setting up worker session")
spec = self.gateway.spec
args = self.config.args
if not spec.popen or spec.chdir:
Expand All @@ -80,7 +80,7 @@ def setup(self):
self.channel.setcallback(
self.process_from_remote,
endmarker=self.ENDMARK)
self.channel.send((self.slaveinput, args, option_dict, None))
self.channel.send((self.workerinput, args, option_dict, None))


def apply_patches():
Expand Down
6 changes: 3 additions & 3 deletions pytest_cloud/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Distributed tests planner plugin for pytest testing framework.
Provides an easy way of running tests amoung several test nodes (slaves).
Provides an easy way of running tests amoung several test nodes (workers).
"""
from __future__ import division

Expand Down Expand Up @@ -37,7 +37,7 @@ class CloudXdistPlugin(object):
@pytest.mark.trylast
def pytest_configure(config):
"""Register pytest-cloud's deferred plugin."""
if (getattr(config, 'slaveinput', {}).get('slaveid', 'local') == 'local' and
if (getattr(config, 'workerinput', {}).get('workerid', 'local') == 'local' and
config.option.cloud_nodes and
config.pluginmanager.getplugin('xdist')):
config.pluginmanager.register(CloudXdistPlugin())
Expand Down Expand Up @@ -314,7 +314,7 @@ def get_nodes_specs(

def check_options(config):
"""Process options to manipulate (produce other options) important for pytest-cloud."""
if getattr(config, 'slaveinput', {}).get('slaveid', 'local') == 'local' and config.option.cloud_nodes:
if getattr(config, 'workerinput', {}).get('workerid', 'local') == 'local' and config.option.cloud_nodes:
patches.apply_patches()
mem_per_process = config.option.cloud_mem_per_process
if mem_per_process:
Expand Down

0 comments on commit 2d0ba47

Please sign in to comment.