Requesting a fixture in a pytest.Item item #10915
Unanswered
GergelyKalmar
asked this question in
Q&A
Replies: 1 comment
-
Currently fixtures are not extended to items in the general sense |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to request a specific fixture in a pytest.Item object that is part of a plugin (something similar to this: https://github.com/logikal-io/pytest-logikal/blob/main/pytest_logikal/licenses.py#L56), however, I couldn't find a way to actually do that. I don't need the return value of the fixture, I just need the side effect to take place.
I've found out that I can add marks in the
__init__
function viaself.add_marker('xxx')
, however, I couldn't find a way to make the item request a fixture beforeruntest
runs (and call the teardown whenruntest
is done). Is that possible somehow? I tried to call the fixture directly, but that gave me an error:Beta Was this translation helpful? Give feedback.
All reactions