Sealing Clocks, Seeds and UUIDs Before Refactoring a Messy Python Repo
Golden-file tests often fail not because of code changes but because of nondeterministic inputs such as clocks, random seeds, UUIDs and hash ordering. The article recommends first auditing the codebase with a grep to count these entropy sources, then freezing them in a pytest fixture. It stresses reseeding per test and setting PYTHONHASHSEED in the runner rather than the fixture. To verify stability, the author suggests running the characterization suite twenty times and confirming that only one unique digest of the snapshots appears before recording any baseline.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in