Replies: 1 comment 1 reply
-
Probably, your app fixture is session level. That is why you need separate fixture, function level, which will clean everything after each test and do no create app each test. You can solve it, with creating other function level fixture, which will sent app session level and then clean app everything. Then use app-function level everywhere in test it needs, and it will cleanup after test and do not destroy app object. And you will not have autouse fixtures, tests which no need app will not use it:
|
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
Uh oh!
There was an error while loading. Please reload this page.
-
The title might sound like this is an XY problem, so let me explain.
I have a session scope fixture
app
, and a few other wide scope fixtures that depend on it. Also I have a fixture that does some appcleanup
and I want it to run after each test. So I've got tests like this:Now, I don't want to say
cleanup
in each test function arguments so I want to make it used automatically. However, if I dothen
cleanup
will also get called for tests that do not ask forapp
, which could breakcleanup
, and if I dothe app will be also constructed for tests that that do not ask for it, which is also problematic.
I could do the following, which should work,
but I will then have
cleanup
for every test in--setup-plan
. Is there a better way?Beta Was this translation helpful? Give feedback.
All reactions