distributed testing fails if tests not in package

Issue #64 resolved
Former user created an issue

Hi Holger,

If I run local with the following all of my tests run correctly:

py.test --verbose tests/

However if I run distributed with the following all tests are errors reporting that they can't find any of the test modules under the tests dir:

py.test --verbose --dist=load --tx ssh=host1 --tx ssh=host2 --rsyncdir myproject --rsyncdir tests tests/

_______ ERROR at setup of test_a ________ [gw1] ssh=host2 -- platform linux2, Python 2.6.4-final-0 cwd: /home/username/pyexecnetcache- /usr/bin/python

self = <CallInfo when='setup' exception: [No such file or directory]: /home/username/pyexecnetcache/test_a.py> func = <bound method Function._checkcollectable of <Function 'test_a'>>, when = 'setup'

def __init__(self, func, when):
    self.when = when
      self.result = func()


The issue is fixed by putting a init.py in the tests dir which makes it a package.

It should probably be a package anyway - I was just starting to experiment with distributed testing so didn't have one yet!

Not sure if it's something that you think needs to be fixed, but it would be good if at the least the docs clearly state that the tests must be in a package structure for distributed testing to work.

On a side note it would also be good to clearly state in the docs that execnet is required for distributed testing - I know it's in there but it's not clear that it is needed on the target hosts that are being logged into rather than just the source host running the py.test command. I found this to also give a rather cryptic message!

Hopefully a couple of statements in the docs will help others get up and running more quickly.

Nice work on the recent py.test and execnet releases - I'm enjoying using these - very smooth :)

Comments (3)

  1. Former user Account Deleted

    I just checked and raised diff issue since you fixed this one about the init.py file :)

  2. Log in to comment