I have Ubuntu host with environment: Python 3.6.9, pytest-4.6.9, execnet 1.7.1, x-dist 1.31.0
and Windows host: Windows Version 10.0.19041.508, python 3.7.5, pytest 5.4.1, execnet 1.7.1
I want to run tests on Windows host from Ubuntu, using x-dist plugin: pytest -v -d --tx [email protected] --rsyncdir /etc/ansible/autotests/release C:\users\Public\test_create_session.py
I get errors:
============================= test session starts =============================
platform linux -- Python 3.6.9, pytest-4.6.9, py-1.8.1, pluggy-0.13.1 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /etc/ansible/autotests/release
plugins: teamcity-messages-1.27, xdist-1.31.0, forked-1.1.3
gw0 I�� 㤠���� �믮����� 㪠������ �ணࠬ��.
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/lib/python3.6/dist-packages/_pytest/main.py", line 204, in wrap_session
INTERNALERROR> config.hook.pytest_sessionstart(session=session)
INTERNALERROR> File "/home/test/.local/lib/python3.6/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/home/test/.local/lib/python3.6/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/home/test/.local/lib/python3.6/site-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "/home/test/.local/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/home/test/.local/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/home/test/.local/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/lib/python3.6/dist-packages/xdist/dsession.py", line 78, in pytest_sessionstart
INTERNALERROR> nodes = self.nodemanager.setup_nodes(putevent=self.queue.put)
INTERNALERROR> File "/usr/local/lib/python3.6/dist-packages/xdist/workermanage.py", line 64, in setup_nodes
INTERNALERROR> nodes.append(self.setup_node(spec, putevent))
INTERNALERROR> File "/usr/local/lib/python3.6/dist-packages/xdist/workermanage.py", line 68, in setup_node
INTERNALERROR> gw = self.group.makegateway(spec)
INTERNALERROR> File "/usr/local/lib/python3.6/dist-packages/execnet/multi.py", line 111, in makegateway
INTERNALERROR> """)
INTERNALERROR> File "/usr/local/lib/python3.6/dist-packages/execnet/gateway.py", line 119, in remote_exec
INTERNALERROR> gateway_base.dumps_internal((source, call_name, kwargs)))
INTERNALERROR> File "/usr/local/lib/python3.6/dist-packages/execnet/gateway_base.py", line 710, in _send
INTERNALERROR> message.to_io(self._io)
INTERNALERROR> File "/usr/local/lib/python3.6/dist-packages/execnet/gateway_base.py", line 130, in to_io
INTERNALERROR> io.write(header+self.data)
INTERNALERROR> File "/usr/local/lib/python3.6/dist-packages/execnet/gateway_base.py", line 101, in write
INTERNALERROR> self.outfile.flush()
INTERNALERROR> BrokenPipeError: [Errno 32] Broken pipe
When I run the same tests on other Windows host all works fine without errors. I think this Windows host response with something unexpected, but I can not understand what the problem. Can anybody help me?
The problem was on Remote Windows host. There was no path to python interpreter (in environment variable Path) for System (there was only for user). I added path to Python and Pytest in Path environment variable for System and it worked!
How i located this:
I made simple script for check if execnet (remote code execution) work or not:
import execnet, os
gw = execnet.makegateway(ssh="[email protected]")
channel = gw.remote_exec("""
import sys, os
channel.send((sys.platform, tuple(sys.version_info), os.getpid()))
""")
platform, version_info, remote_pid = channel.receive()
print(f"Platform: {platform}, Version Info: {version_info}, Remote Pid: {remote_pid}")
this script did not work and I realized that the problem is not in pytest, but in the remote host, which cannot execute the code. this way i started checking system variables