Python Patching And Time Pitfalls

Use when a Python test patches a function, an attribute, an environment variable, the working directory or the path with pytest's monkeypatch, needs a temporary directory (tmp_path, basetemp), or freezes the clock with freezegun: patching the name the code looks up rather than the original, never patching builtins, scoping stdlib patches, what monkeypatch undoes, the raising flag, a guard against real network calls, tmp_path retention and basetemp, what freezegun freezes, ticking, timezone offset, asyncio sleep, default arguments and the ignore list.

techmefr Updated

File contents

techmefr/mentis commit 05aad883b9

Frequently asked questions

npx get-skill add techmefr/python-patching-and-time-pitfalls