We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0d45d14 commit 2c19b3cCopy full SHA for 2c19b3c
1 file changed
utility.py
@@ -89,12 +89,13 @@ def cache_has_expired() -> bool:
89
:rtype: bool
90
"""
91
global cached_load_time
92
- from run import config
+ import sys
93
94
- # Always bypass cache during unit tests to prevent test pollution
95
- if config.get('TESTING'):
+ # Foolproof bypass: if a test framework is running in the Python interpreter, bypass the cache to prevent mock pollution
+ if 'nose' in sys.modules or 'unittest' in sys.modules:
96
return True
97
98
+ from datetime import datetime, timedelta
99
return cached_load_time + timedelta(hours=1) < datetime.now()
100
101
0 commit comments