[pytest-dev] pytest_plugin with session scope fixture
holger krekel
holger at merlinux.eu
Mon Nov 24 17:18:49 CET 2014
Hi Jens,
On Mon, Nov 24, 2014 at 13:57 +0100, Jens Hoffmann wrote:
> Hi everybody,
>
> I have a problem concering the following setup:
>
> - I have written a pytest plugin defining a session scope fixture
> - in my test files - say ./test/a/test_foo.py and
> ./test/b/test_bar.py I ``import'' the pytest plugin via declaring
> the pytest_plugins variable: pytest_plugins = 'my.cool.plugin'
>
>
> So, there's no conftest.py - say below ./test, that declares
> my.cool.plugin ``globally'' for test/a and test/b
>
>
>
> What is the session scope in this setup when I run ``py.test test''
> on the command line? Is the scope split in test/a and test/b or do
> we still have a ``real'' session scope for everything below test?
"my.cool.plugin" will have a "global" session scope which means test/a
and test/b will share the same session-scoped fixture instances.
> My real but similar setup seems to split the scope into chunks of
> modules which contain test files which declare pytest_plugins... but
> may be I am wrong...
> Is that possible?
I don't understand the question, sorry.
Also I am not sure why you use the indirection of "pytest_plugins".
why do conftest.py files or setuptools-installed plugijns not work for you?
holger
More information about the pytest-dev
mailing list