Tests pass in order but fail with pytest-randomly, turns out global state
pytest 8.2 with pytest-randomly. About five of our tests fail only when randomization puts them in a certain order. I tracked it down to a module-level cache dict that one test populates and another assumes is empty. I added a fixture to clear it, but I'd rather find all such cases at once. Is there a tool for detecting test-order dependencies systematically?
4 replies