Closed
Description
Hello,
Version: I'm running Ubuntu 14.04 with pytest 3.4.0.
Use case: I am using a session scoped fixture which I import and use in two different test files.
Issue: The fixture is run one time for each file when I expect it to be run only once for the whole session.
Example:
fixtures.py
import pytest
@pytest.fixture(scope="session")
def my_fixture():
print "Hello"
test1.py
from fixtures import my_fixture
def test_example(my_fixture):
pass
test2.py
from fixtures import my_fixture
def test_example2(my_fixture):
pass
Hello is printed twice instead of once.
Workaround: A workaround is to import it in the conftest but since I am using hundred of fixtures, I prefer not to import everything in the conftest.