Session scoped fixture run multiple times when adding fixture via metafunc #5738 #12931
Labels
stale
status: needs information
reporter needs to provide more information; can be closed after 2 or more weeks of inactivity
topic: fixtures
anything involving fixtures directly or indirectly
Refering to this ticket : Session scoped fixture run multiple times when adding fixture via metafunc
#5738 : i am trying to achieve the following:
----conftest.py ----
s1_sheet_config, boot_config etc are lists.
def pytest_generate_tests(metafunc):
"""Dynamically parameterize tests based on loaded configurations."""
if 's1_sheet_idx' in metafunc.fixturenames:
metafunc.parametrize("s1_sheet_idx", [s1_sheet_config], indirect=True)
---- main.py----
@pytest.mark.parametrize("index", bt_sheet_idx)
def test_boot__sanity(self, index, obj_basic_config=TestBootConfig(), upd_count=TestIncrement(), test_reg=Register()):
......
@pytest.mark.parametrize("index", dt_idx)
def test_dev_sanity(self, index, obj_basic_config=TestBootConfig(), upd_count=TestIncrement(), test_reg=Register()):
.....
I want to execute the complete tests defined in the main.py file for one set of parametrized input first then the reload the new values for the next session and exectue the same tests again for the new set of loaded values.
Test Result should be:
test_boot_sanity [1-1-0] -- PASSED --> Test function for 0 index value
test_boot_sanity [1-1-1] -- PASSED --> Test function for 1 index value
test_boot_sanity [1-2-2] -- PASSED --> Test function for 2 index
:
test_dev_sanity [ 2-2-0] -- PASSED
test_dev_sanity [ 2-2-1] -- PASSED
test_dev_sanity [ 2-2-2] -- PASSED
However, seems only first case is executing... Any help is much appreciated.
The text was updated successfully, but these errors were encountered: