Replies: 1 comment 1 reply
-
@The-Compiler I'm facing the same issue. Is there a solution for this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am currently using pytest 8.3.3 and have encountered unexpected behavior with fixtures scoped at the "package" level in a workspace structured as follows:
Test/
├── conftest.py # Fixture with scope="session"
├── group1/
│ ├── conftest.py # Fixture with scope="package" (name: setup_teardown_group1)
│ ├── tc1.py
│ └── tc2.py
└── group2/
├── conftest.py # Fixture with scope="package" (name: setup_teardown_group2)
├── tc3.py
└── tc4.py
Observed Behavior
The setup_teardown_group1 fixture (defined in group1/conftest.py with scope="package") seems to be applied to all test items (tc1, tc2, tc3, and tc4), rather than being limited to only tests in the group1 directory.
Expected Behavior
I expected setup_teardown_group1 to apply exclusively to tests in the group1 directory and setup_teardown_group2 to apply only to tests in group2.
Question
Is this the intended behavior for "package" scoped fixtures in nested directories, or is it a potential issue with scope inheritance in pytest?
Thanks in advance for your assistance in understanding this behavior.
Beta Was this translation helpful? Give feedback.
All reactions