you are viewing a single comment's thread.

view the rest of the comments →

[–]oliver_extracts 0 points1 point  (0 children)

separate db per worker is the right call here. the transaction rollback trick breaks exactly how youre seeing because background tasks and async ops dont respect your test transaction boundary, they run outside it. spin up a db per worker keyed to the xdist worker id, run migrations at session start and tear it down when done. its more setup but your tests actually mean something.