Closed
Description
Hey, guys. So I have this scenario where I would really appreciate some help.
Here is a mock example:
├──parent
│ ├──test1dir
│ │ ├ conftest.py
│ │ ├ test_1.py
│ ├ conftest.py
# parent/test1dir/conftest.py
def pytest_runtest_setup(item):
do_something(item, local_fixt())
# --> somehow set global_var in parent conftest <--
@pytest.fixture(scope="session")
def local_fixt():
return 123
# parent/test1dir/conftest.py
@pytest.fixture(scope="session") # same for function scoped fixtures
def session_fixt(local_fixt)
do_something(global_var)
do_something(local_fixt)
Reason why I don't move pytest_runtest_setup in parent conftest is that I need it to access local_fixt() and it isn't able to do that from the upper conftest file as it would solve this issue.