pytest and lru_cache
I have a pytest of a function that uses python @lru_cache
:
cacheinfo = gbif_get_taxonomy_id.cache_info()
assert cacheinfo.hits == 1
assert cacheinfo.misses == 2
LRU cache gets preserved among test runs, breaking independence and making such bits fail.
Enter pytest-antilru · PyPI which resets the LRU cache between test runs. Installing it as a python package is all there’s to ite.
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus