[TIP] py.test plugins specified with -h are not loaded with xdist

Yoann Roman silentsound+tip at gmail.com
Tue Mar 15 13:06:09 PDT 2011


On Tue, Mar 15, 2011 at 3:51 PM, holger krekel wrote:
>
> On Tue, Mar 15, 2011 at 15:42 -0400, Yoann Roman wrote:
> > I have a custom py.test plugin in a package. When I load it with
> > py.test -h package.plugin, it loads fine. When I use py.test -h
> > package.plugin -n 4, the main session loads it, but the plugin isn't
> > loaded by the separate 4 processes running the tests.
>
> Hum, never tried to run the help option distributedly :)

I like my nodes well-informed :-).

> Or do you rather mean "py.test -p package.plugin"?
>
> If so then it would be a bug if it doesn't work.  It'd
> be nice if you include a trace / example trace to the issue
> https://bitbucket.org/hpk42/pytest/issue/34

I did mean -p. I don't actually get a traceback from py.test, just
from my tests. When they start running, the environment that my plugin
would have set up is missing. If I specify the plugin with a
conftest.py file or use -p without multiprocessing, everything works.

I'll try to create a smaller environment to reproduce this.

> > Is that expected behavior? Is using a conftest.py file the only way to
> > get a project-specific plugin loaded?
>
> it's kind of the default way.  But in principle you should be able
> to also specify a module with "-p" and to also add it to
> the "addopts" option in the .ini file.

That's what I thought, but it's not working.

-- 
Yoann Roman



More information about the testing-in-python mailing list