# Run standard cache assertion
self.assertEqual(c.add_cached, None)
-
-class TestThreadingIssues(unittest.TestCase):
-
def test_threads(self):
""" How well does the standard cached_property implementation work with threads?
Short answer: It doesn't! Use threaded_cached_property instead!
from cached_property import cached_property
-class TestCachedProperty(unittest.TestCase):
+class TestCachedPropertyWithTTL(unittest.TestCase):
def test_cached_property(self):
# Run standard cache assertion
self.assertEqual(c.add_cached, None)
-
-class TestThreadingIssues(unittest.TestCase):
-
def test_threads(self):
""" How well does the standard cached_property implementation work with threads?
Short answer: It doesn't! Use threaded_cached_property instead!
# preemption.
self.assertEqual(c.add_cached, num_threads)
-
-class TestCachedPropertyWithTTL(unittest.TestCase):
-
def test_ttl_expiry(self):
class Check(object):
self.assertEqual(c.add_cached, 2)
-class TestCachedProperty(unittest.TestCase):
+class TestThreadedCachedPropertyWithTTL(unittest.TestCase):
def test_cached_property(self):
# Run standard cache assertion
self.assertEqual(c.add_cached, None)
-
-class TestThreadingIssues(unittest.TestCase):
-
def test_threads(self):
""" How well does this implementation work with threads?"""
for thread in threads:
thread.join()
- self.assertEqual(c.add_cached, 1)
\ No newline at end of file
+ self.assertEqual(c.add_cached, 1)
from cached_property import threaded_cached_property
-class TestCachedProperty(unittest.TestCase):
+class TestThreadedCachedProperty(unittest.TestCase):
def test_cached_property(self):
# Run standard cache assertion
self.assertEqual(c.add_cached, None)
-
-class TestThreadingIssues(unittest.TestCase):
-
def test_threads(self):
""" How well does this implementation work with threads?"""