Skip to content

pytest-cloud is not working with pytest-xdist>1.25.0 #16

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

Closed
dasm opened this issue Apr 23, 2020 · 3 comments
Closed

pytest-cloud is not working with pytest-xdist>1.25.0 #16

dasm opened this issue Apr 23, 2020 · 3 comments
Assignees

Comments

@dasm
Copy link
Contributor

dasm commented Apr 23, 2020

pytest-xdist introduced breaking change to pytest-cloud with the release of 1.26.0 version change request

(venv2) ➜  utils git:(master) ✗ pytest test_name.py --cloud-node=hostname --cloud-python=python2 -s
Detected root dir: /apps/utils
Detecting connectable test nodes...
Found 1 connectable test nodes: set(['hostname'])
RSyncing directory structure
rsync: -arHAXx: unknown option
rsync error: syntax or usage error (code 1) at /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-54/rsync/main.c(1337) [client=2.6.9]
RSync finished
Scheduling with 12 parallel test sessions
============================================================================================================================= test session starts ==============================================================================================================================
platform darwin -- Python 2.7.17, pytest-4.6.9, py-1.8.1, pluggy-0.13.1
rootdir: /Users/dsmigiel/apps/dcp-test-utils, inifile: pytest.ini
plugins: timeout-1.3.4, ansible-playbook-0.4.1, xdist-1.31.0, forked-1.1.3, metadata-1.8.0, json-report-1.2.1, cloud-3.0.1
timeout: 600.0s
timeout method: signal
timeout func_only: False
hostname_0 C / (...) / hostname_11 C[hostname_0] node down: Traceback (most recent call last):
  File "<string>", line 1084, in executetask
  File "<string>", line 1, in do_exec
  File "/apps/utils/venv2/lib/python2.7/site-packages/xdist/remote.py", line 232, in <module>
ValueError: need more than 3 values to unpack

After downgrading to xdist-1.25.0

(venv2) ➜  utils git:(master) ✗ pytest test_name.py --cloud-node=hostname --cloud-python=python2
Detected root dir: /apps/utils
Detecting connectable test nodes...
Found 1 connectable test nodes: set(['hostname'])
RSyncing directory structure
rsync: -arHAXx: unknown option
rsync error: syntax or usage error (code 1) at /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-54/rsync/main.c(1337) [client=2.6.9]
RSync finished
Scheduling with 12 parallel test sessions
============================================================================================================================= test session starts ==============================================================================================================================
platform darwin -- Python 2.7.17, pytest-4.6.9, py-1.8.1, pluggy-0.13.1
rootdir: /apps/utils, inifile: pytest.ini
plugins: timeout-1.3.4, xdist-1.25.0, ansible-playbook-0.4.1, forked-1.1.3, metadata-1.8.0, json-report-1.2.1, cloud-3.0.1
timeout: 600.0s
timeout method: signal
timeout func_only: False
hostname_0 C / (...) / hostname_11 C[hostname_0] node down: Traceback (most recent call last):
  File "<string>", line 1084, in executetask
  File "<string>", line 1, in do_exec
  File "/apps/utils/venv2/lib/python2.7/site-packages/xdist/remote.py", line 266, in <module>
  File "/apps/utils/venv2/lib/python2.7/site-packages/xdist/remote.py", line 242, in remote_initconfig
  File "/remote/pytest_username_utils/venv2/lib/python2.7/site-packages/_pytest/config/__init__.py", line 787, in fromdictargs
    config.parse(args, addopts=False)
  File "/remote/pytest_username_utils/venv2/lib/python2.7/site-packages/_pytest/config/__init__.py", line 953, in parse
    args, self.option, namespace=self.option
  File "/remote/pytest_username_utils/venv2/lib/python2.7/site-packages/_pytest/config/argparsing.py", line 101, in parse_setoption
    parsedoption = self.parse(args, namespace=namespace)
  File "/remote/pytest_username_utils/venv2/lib/python2.7/site-packages/_pytest/config/argparsing.py", line 81, in parse
    return self.optparser.parse_args(args, namespace=namespace)
  File "/remote/pytest_username_utils/venv2/lib/python2.7/site-packages/_pytest/config/argparsing.py", line 349, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib64/python2.7/argparse.py", line 1720, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib64/python2.7/argparse.py", line 1944, in _parse_known_args
    self.error(_('argument %s is required') % name)
  File "/remote/pytest_username_utils/venv2/lib/python2.7/site-packages/_pytest/config/argparsing.py", line 345, in error
    raise UsageError(self.format_usage() + msg)
UsageError: usage: -c [options] [file_or_dir] [file_or_dir] [...]
-c: error: argument --workspace is required

In second example, last error doesn't matter. It is caused by test itself.

@dasm dasm self-assigned this Apr 23, 2020
@dasm
Copy link
Contributor Author

dasm commented Apr 23, 2020

Immediate solution is to lock on pytest-xdist<1.26.0 version. However, I'd like to look into the code why this problem is happening with latest xdist.

@dasm
Copy link
Contributor Author

dasm commented Apr 23, 2020

I think I found the problem

diff --git a/pytest_cloud/patches.py b/pytest_cloud/patches.py
index 0a69e0b..cf33669 100644
--- a/pytest_cloud/patches.py
+++ b/pytest_cloud/patches.py
@@ -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))
+    self.channel.send((self.slaveinput, args, option_dict, None))

@dasm
Copy link
Contributor Author

dasm commented Apr 24, 2020

Fix will be released in new version.

@dasm dasm closed this as completed Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant