Why does pytestmark with usefixtures not work in conftest.py? #12677
-
I'd like to enable a third-party fixture for all tests in the test suite. I thought I could do this by adding a Is there a way to declare to use a fixture to be used for all tests? I asked Gemini, but it offers wrong answers only. Pytest version is latest (8.3.2). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
conftests are plugins, not part of the node tree, thats why a marker on them will not propagate (for good reason) the recommended way to have a fixture happen for all tests is a autouse fixture |
Beta Was this translation helpful? Give feedback.
The alternative would be to add the marker to the session, which is hacky in another way
The recommended Way to activate a fixture for everything is to have a autouse fixture depend on it