cached-property
cached-property copied to clipboard
1 test fails
========================================================================================== FAILURES ==========================================================================================
_____________________________________________________________________ TestCachedPropertyWithTTL.test_threads_ttl_expiry ______________________________________________________________________
self = <tests.test_cached_property.TestCachedPropertyWithTTL testMethod=test_threads_ttl_expiry>
def test_threads_ttl_expiry(self):
Check = CheckFactory(self.cached_property_factory(ttl=100000), threadsafe=True)
check = Check()
num_threads = 5
# Same as in test_threads
check.run_threads(num_threads)
self.assert_cached(check, num_threads)
self.assert_cached(check, num_threads)
# The cache expires in the future
with freeze_time("9999-01-01"):
check.run_threads(num_threads)
> self.assert_cached(check, 2 * num_threads)
tests/test_cached_property.py:244:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_cached_property.py:71: in assert_cached
self.assertEqual(check.add_cached, expected)
E AssertionError: 6 != 10
====================================================================================== warnings summary ======================================================================================