-
How to add a fixture to tests in a hook using metafunc/request. I saw a solution to add a fixture to tests during But this does not use the fixture implementation, it is just used during ordering/generation but is not executed at all during test execution. Or at least it is not the case anymore with What would be the correct way of achieving this right now? Thank you in advance. DetailsIn a test library, we would like to be able to do pre-post checks for tests that These checks could be defined in the test suite, so without Alternatives consideredMulti layersThis could be handled by having some intermediate fixture. HooksI thought about having instead hooks defined in the library, but then these Hacky autouseWe currently relied on the following pattern:
But that does not work reliably for anything else than And the wrapper fixtures cannot use any fixture that rely on Overwriting the fixture nameSome way could be the following syntax, but it does not work and it would force
Overwriting 'Fixturemanager'I tried changing the "Fixturemanager" plugin, but I could not re-register a new I could check more, but yeah not sure if it's a good way. IdeaIt could be phrased in the following way of writing:
Where it would get I imagine the limitation of how fixture definition scopes, to which tests when Relying on "fixture(autouse=True)" has the issue that it trigger adding other Last resortThe answer could also be "just copy-paste the implementation with all the private methods" but wanted to be sure before doing such things. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Oh I just thought that I could rely on adding a I will explore this and post update here. |
Beta Was this translation helpful? Give feedback.
-
Did not manage to use I was careful to not add duplicates but it may not be required.
|
Beta Was this translation helpful? Give feedback.
Did not manage to use
mark.usefixtures
.The solution that worked for me is the following.
I was careful to not add duplicates but it may not be required.
It is working without the "if name in".