Testing: exceptions and caches

244 · Ned Batchelder · Jan. 25, 2026, 10:34 p.m.
Summary
This blog post discusses two testing strategies in Python: one for unifying exception testing using pytest's parameterization, and another regarding the implications of using the @lru_cache decorator, which can introduce unintended side effects in tests. It presents a new pytest plugin, pytest-antilru, that facilitates better cache management during tests.