[py-dev] xdist and pytest.main

Adam Goucher adam at goucher.ca
Sun Aug 5 23:31:33 CEST 2012

Whoops. Didn't look at the list reply-to settings so pulling the list 
back in. This does seem to be the cause. I commented out the 
sys.path.append in the wrapper and added

def pytest_configure(config):
     sys.path.append(os.path.join(os.getcwd(), "modules"))

to the conftest.py in the root and it 'seems' to be working.

My initial thoughts around error detection still stands though.

Thanks for the nudge to finding the solution.

> A little more debugging (including the --debug flag) has led me to 
> something I believe...
> For context my wrapper runs from a prescribed directory structure 
> shown at 
> https://github.com/Element-34/Py.Saunter-Examples/tree/master/ebay 
> (for example). And part of that wrapper is a modification to the 
> system path as such
> sys.path.append(os.path.join(cwd, "modules"))
> What I am now guessing is that the environment does not get forked 
> into the slave processes as alluded to in this message.
> [slave-gw1] sending collectreport {'data': {'longrepr': 
> 'scripts/DressShirts.py:15: in <module>\n>   from 
> saunter.testcase.webdriver import 
> SaunterTestCase\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytest-2.2.4-py2.7.egg/_pytest/assertion/rewrite.py:156: 
> in load_module\n>           py.builtin.exec_(co, 
> mod.__dict__)\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py.saunter-0.48-py2.7.egg/saunter/testcase/webdriver.py:34: 
> in <module>\n>       from tailored.webdriver import WebDriver\nE       
> ImportError: No module named tailored.webdriver', 'outcome': 'failed', 
> 'sections': [], 'result': None, 'nodeid': 'scripts/DressShirts.py'}}
> If that is the case [and I have to go fix my sister's email else I 
> would debug it further]
> a) how do I pass that environment change to my forked processes 
> (guessing just move that to conftest.py?)
> b) if there is an exception thrown in the collection process on a 
> slave, it likely should bubble up to the user
> -adam
>> Hum, this looks like no tests are collected at all.  If you leave
>> away the "-n" option, tests do run?  Can you show the -v output of
>> that?  I assume you are running things in the correct directory
>> and have no change-directory code in your tests/plugin?
>> best,
>> holger

More information about the Pytest-dev mailing list