Replies: 1 comment 2 replies
-
Are you looking for |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using pytest to run tests which produce some side effects. A fixture is used to allow the test to control specifics of how those side effects are created, and in the teardown of the fixture there is some evaluation if the tests produced correct results.
However if I throw an error in the fixture teardown, pytest marks the associated test as
passed
with anerror
. This produces problems in the evaluation, because the test technically should have failed.I've been trying to use hooks to solve that, but had no success:
With this approach I don't have information about teardown yet.
With this approach I am already in teardown and can't call
pytest.fail
anymore.Is there a good solution for this? I'd like to not move my check logic into a
pytest_runtest_call
hook, because it relies onrequest
andpytestconfig
which I get very simply as arguments to my fixture.Beta Was this translation helpful? Give feedback.
All reactions