ipwnponies / pytest-antilru

Bust functools.lru_cache when running pytest to avoid test pollution
MIT License
22 stars 3 forks source link

Limit scope of monkey patched lru_cache #12

Closed ipwnponies closed 5 years ago

ipwnponies commented 5 years ago

https://github.com/ipwnponies/pytest-antilru/blob/a78af3da55c6b71e1c2172c3368c70f6f7d93713/pytest_antilru/main.py#L29

The scope of monkey-patched lru_cache should be limit, to avoid any potential side effects. We only want to monkey patch test code, which is setup upon test collection. Once collection is done, reset it to be a good citizen and limit impact to other plugins.