Testing: exceptions and caches

· 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.
AUTHOR
Sponsored
Zulip logo Zulip
Organized team chat for people who take work seriously. Topic-based threading keeps conversations focused.
Try Zulip
Become a sponsor →
BLOG POST FEATURED ON

Add this plugin to your blog