[pytest-dev] pytest_plugin with session scope fixture

Jens Hoffmann jh at solute.de
Mon Nov 24 13:57:22 CET 2014


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 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?




Thank you for your answer,
Jens



More information about the pytest-dev mailing list