Replies: 1 comment
-
One can share the state between the scope level fixture and function level fixture like this:
With this solution, I get the "duh" for each failed test in the test summary and errors when trying to set up a test, which makes it clear what the problem is. |
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 have a pattern that is used for integration tests in two scope level fixtures now: 1) start a Kubernetes pod and open a tunnel to it; 2) run a service with Docker and expose it's details, such that all test use the service. The code looks like this:
Sometimes the service crashes, which results in connection errors in all tests--the snippet above gives me an
ERROR at teardown
in the very beginning of the pytest output and a list of connection error failures in each test.The issue is that for the users of the tests it is not clear why exactly the connection error happened--no explicit connection between the the connection errors and a teardown failure, which reports the crashed container. Could you think of a way to make this connection obvious? Ideally, I would rather abort all tests if the docker container went down.
Could someone suggest a way to achieve that?
So far the only idea I have is to create a function scoped fixture which will check the status of the service before the start--for that to work, I need to figure out how to share state between the scope level fixture that creates container and a function level fixture that checks the status of the container,
Beta Was this translation helpful? Give feedback.
All reactions