pytest-dev / pytest-xdist

pytest plugin for distributed testing and loop-on-failures testing modes.
https://pytest-xdist.readthedocs.io
MIT License
1.46k stars 232 forks source link

WindowsError: [Error 2] when trying to run test from windows 10 on a remote raspberrypi via ssh #498

Open Parkplatzwaechter opened 4 years ago

Parkplatzwaechter commented 4 years ago

I am trying to run some pytest testcases on a remote raspberrypi via pytest-xdist ssh.

The localhost from which I want to run the tests has Windows 10 and the raspberrypi runs with Raspbian.

The tests use the standard pytest naming conventions an are located in a single file test_cases.py. This file also includes the code that is being tested. The folder named "test_cases" has a init.py like stated in the xdist documentation as well as the main-folder "remotetest".

All test run fine when startet locally. So it seems to be no problem with the tests itself.

ssh connection to the raspberrypi is also working (I am using authentication-keys in order to not needing to enter a password everytime).

But if I try to run the tests via xdist ssh on the raspberrypi I always get the following error and can't really figure out the reason. I use for example: pytest -d --tx ssh=pi@raspberrypi//python=python2.7 --rsyncdir test_cases

C:\remotetest>pytest -d --tx ssh=pi@raspberrypi//python=python2.7 --rsyncdir test_cases ============================= test session starts ============================= platform win32 -- Python 2.7.14, pytest-4.6.4, py-1.8.0, pluggy-0.12.0 rootdir: C:\remotetest plugins: forked-1.1.3, xdist-1.31.0 gw0 IINTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "c:\python27\lib\site-packages\_pytest\main.py", line 204, in wrap_session INTERNALERROR> config.hook.pytest_sessionstart(session=session) INTERNALERROR> File "c:\python27\lib\site-packages\pluggy\hooks.py", line 289, in __call__ INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "c:\python27\lib\site-packages\pluggy\manager.py", line 87, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "c:\python27\lib\site-packages\pluggy\manager.py", line 81, in <lambda> INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "c:\python27\lib\site-packages\pluggy\callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "c:\python27\lib\site-packages\pluggy\callers.py", line 81, in get_result INTERNALERROR> _reraise(*ex) # noqa INTERNALERROR> File "c:\python27\lib\site-packages\pluggy\callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "c:\python27\lib\site-packages\xdist\dsession.py", line 78, in pytest_sessionstart INTERNALERROR> nodes = self.nodemanager.setup_nodes(putevent=self.queue.put) INTERNALERROR> File "c:\python27\lib\site-packages\xdist\workermanage.py", line 64, in setup_nodes INTERNALERROR> nodes.append(self.setup_node(spec, putevent)) INTERNALERROR> File "c:\python27\lib\site-packages\xdist\workermanage.py", line 68, in setup_node INTERNALERROR> gw = self.group.makegateway(spec) INTERNALERROR> File "c:\python27\lib\site-packages\execnet\multi.py", line 133, in makegateway INTERNALERROR> io = gateway_io.create_io(spec, execmodel=self.execmodel) INTERNALERROR> File "c:\python27\lib\site-packages\execnet\gateway_io.py", line 121, in create_io INTERNALERROR> io = Popen2IOMaster(args, execmodel) INTERNALERROR> File "c:\python27\lib\site-packages\execnet\gateway_io.py", line 21, in __init__ INTERNALERROR> self.popen = p = execmodel.PopenPiped(args) INTERNALERROR> File "c:\python27\lib\site-packages\execnet\gateway_base.py", line 184, in PopenPiped INTERNALERROR> return self.subprocess.Popen(args, stdout=PIPE, stdin=PIPE) INTERNALERROR> File "c:\python27\lib\subprocess.py", line 390, in __init__ INTERNALERROR> errread, errwrite) INTERNALERROR> File "c:\python27\lib\subprocess.py", line 640, in _execute_child INTERNALERROR> startupinfo) INTERNALERROR> WindowsError: [Error 2] Das System kann die angegebene Datei nicht finden

I tried many variants like without specifying the python interpreter or running it directly from within the folder test_cases. Now I am running out of ideas on what to try next or on what to search for. And wanted to ask if anybody can help me with this problem?

One thing I am currently thinking about: Does pytest-xdist need rsync (the actual rsync like on Linux) on the localhost (I couldn't find anything in the documentation on this). And if so where can I get it for Windows 10?

RonnyPfannschmidt commented 4 years ago

xdist does use an actual ssh command, you need ssh.exe for it to work, a paramiko using backend was not implemented yet

Parkplatzwaechter commented 4 years ago

Thanks for the fast response. I have a ssh.exe on my Windows system (OpenSSh). Manual ssh connection via command line to the raspberrypi works fine (it is set up via authentication keys in order to not needing to specify a pw from the windows system). This unfortunately doesn't seem to be the problem.