Commit 7c0dd909 authored by Kirill Smelkov's avatar Kirill Smelkov

Fix tests with ZODB 5.6

By definition IStorage level methods need to be passed in storage-level
IStorageTransactionMetaData, not regular transaction.Transaction
objects:

https://github.com/zopefoundation/ZODB/blob/5.6.0-35-g1fb097b41/src/ZODB/interfaces.py#L827-L830

Passing in there regular transaction.Transaction used to work
historically, but after https://github.com/zopefoundation/ZODB/commit/2f8cc67a
it started to fail as:

    Error in test test_conflict_cache_clears_over_time (tempstorage.tests.testTemporaryStorage.TemporaryStorageTests)
    Traceback (most recent call last):
      File "/usr/lib/python2.7/unittest/case.py", line 329, in run
        testMethod()
      File "/home/kirr/src/wendelin/z/tempstorage/src/tempstorage/tests/testTemporaryStorage.py", line 195, in test_conflict_cache_clears_over_time
        self._dostore(storage, oid1, data=MinPO(5))
      File "/home/kirr/src/wendelin/z/tempstorage/src/tempstorage/tests/testTemporaryStorage.py", line 132, in _dostore
        storage.tpc_begin(t)
      File "/home/kirr/src/wendelin/z/ZODB/src/ZODB/BaseStorage.py", line 193, in tpc_begin
        ext = transaction.extension_bytes
    AttributeError: 'Transaction' object has no attribute 'extension_bytes'

-> Fix it by using storage-level transactions in tests.
parent db55c556
...@@ -107,7 +107,7 @@ class TemporaryStorageTests(unittest.TestCase): ...@@ -107,7 +107,7 @@ class TemporaryStorageTests(unittest.TestCase):
Returns the object's new revision id. Returns the object's new revision id.
""" """
import transaction from ZODB.Connection import TransactionMetaData
from ZODB.tests.MinPO import MinPO from ZODB.tests.MinPO import MinPO
if oid is None: if oid is None:
...@@ -121,7 +121,7 @@ class TemporaryStorageTests(unittest.TestCase): ...@@ -121,7 +121,7 @@ class TemporaryStorageTests(unittest.TestCase):
if not already_pickled: if not already_pickled:
data = StorageTestBase.zodb_pickle(data) data = StorageTestBase.zodb_pickle(data)
# Begin the transaction # Begin the transaction
t = transaction.Transaction() t = TransactionMetaData()
if user is not None: if user is not None:
t.user = user t.user = user
if description is not None: if description is not None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment