Test memory cache with committed transaction as current
The tests did not correspond to a proper use case because the transaction committed was not the current transaction. So this could lead to wrong cache being reset and wrong cache being tested. issue8502 review289171002
This commit is contained in:
1 parent
15ea6bf65b
commit
89c737a819
1 file changed
+4
-5
@@ -93,16 +93,15 @@ class MemoryCacheTestCase(unittest.TestCase):
|
||||
cache.set('foo', 'baz')
|
||||
self.assertEqual(cache.get('foo'), 'baz')
|
||||
|
||||
Transaction().set_current_transaction(transaction1)
|
||||
self.addCleanup(transaction1.stop)
|
||||
self.assertEqual(cache.get('foo'), 'bar')
|
||||
with Transaction().set_current_transaction(transaction1):
|
||||
self.assertEqual(cache.get('foo'), 'bar')
|
||||
|
||||
transaction2.commit()
|
||||
for n in range(10):
|
||||
if cache.get('foo') is None:
|
||||
if cache.get('foo') == 'baz':
|
||||
break
|
||||
self.wait_cache_sync()
|
||||
self.assertEqual(cache.get('foo'), None)
|
||||
self.assertEqual(cache.get('foo'), 'baz')
|
||||
|
||||
def test_memory_cache_nested_transactions(self):
|
||||
"Test MemoryCache with nested transactions"
|
||||
|
||||
Reference in new issue
Block a user