-
I want to conditionally code for some tests before the test's other fixtures run. Its to execute SQL to toggle logging on or off, which needs to happen before the other fixtures create records in the DB. I ideally want to inspect the test's name to determine whether to toggle logging, alternatively I'm happy to use a fixture.
Surely I'm just not finding a builtin hook that runs at the point I need it? I've spent hours poring over the docs and stackoverflow and still can't find it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Sorry, I just realised what I'm asking for is not possible, as a test could require a fixture of higher scope than function. I'll just need to create a function-scoped fixture which sends the statements and require that in other fixtures I use on those tests, which would force them to be function-scoped too. I think it's either that or separating it into two runs with mutually exclusive ignore and exclude patterns which isn't terrible but is really not great either. |
Beta Was this translation helpful? Give feedback.
-
Lines 153 to 155 in e54c6a1 impleemnts te setup even high scope scopes - so having that hook is perfectly fine to implement it - however you need a @hookimpl(tryfirst=true) |
Beta Was this translation helpful? Give feedback.
Sorry, I just realised what I'm asking for is not possible, as a test could require a fixture of higher scope than function.
I'll just need to create a function-scoped fixture which sends the statements and require that in other fixtures I use on those tests, which would force them to be function-scoped too.
I think it's either that or separating it into two runs with mutually exclusive ignore and exclude patterns which isn't terrible but is really not great either.