Replies: 5 comments 3 replies
-
worker processes can get killed for a variety of reasons - I tend to do all resource acquisition and teardown in the leader. I also try to make setup idempotent - eg it would drop the database if it was there |
Beta Was this translation helpful? Give feedback.
-
hi @graingert Thank you for your response ! |
Beta Was this translation helpful? Give feedback.
-
Oh definitely, but the only reason I can think of for your teardown not executing is if pytest is aborted uncleanly, which is somewhat common in xdist scenarios. If you could create an MRE with where your teardown doesn't get executed I could look into it more thoroughly |
Beta Was this translation helpful? Give feedback.
-
Hi @graingert .. thanks a lot for your reply. |
Beta Was this translation helpful? Give feedback.
-
An MRE wouldn't contain any of your company's codebase |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
First, thank you so much for supporting this library !
Second, I am having an issue and I was wondering if you could help me address it /direct me in the right way.
I have a session-wide fixture that creates a DB, yield, and delete the created DB, something like
What I am trying to do is to create a DB per process when the test runs, and drop it when the tests are finished/ an error happens/ an assertion error is raised.
The problem is, it seems like the teardown section (what comes after the yield statement) isn't executed for all processes. The creation part (before yield) is done successfully, but whatever comes after yield is executed for some of the workers and for some not (when the tests don't pass, i.e an assertion error is raised).
What might I be doing wrong here ?
Beta Was this translation helpful? Give feedback.
All reactions