Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
f0f00357
Commit
f0f00357
authored
Nov 17, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated some tests and test support to use TransactionMetaData
parent
d2b72af8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
8 deletions
+12
-8
src/ZODB/FileStorage/tests.py
src/ZODB/FileStorage/tests.py
+3
-2
src/ZODB/tests/IExternalGC.test
src/ZODB/tests/IExternalGC.test
+3
-2
src/ZODB/tests/PackableStorage.py
src/ZODB/tests/PackableStorage.py
+2
-2
src/ZODB/tests/blob_transaction.txt
src/ZODB/tests/blob_transaction.txt
+2
-1
src/ZODB/tests/util.py
src/ZODB/tests/util.py
+2
-1
No files found.
src/ZODB/FileStorage/tests.py
View file @
f0f00357
...
...
@@ -20,6 +20,7 @@ import unittest
import
ZODB.blob
import
ZODB.FileStorage
import
ZODB.tests.util
from
ZODB.Connection
import
TransactionMetaData
from
zope.testing
import
renormalizing
checker
=
renormalizing
.
RENormalizing
([
...
...
@@ -124,7 +125,7 @@ def pack_with_repeated_blob_records():
Now, create a transaction with multiple saves:
>>> trans =
tm.begin
()
>>> trans =
TransactionMetaData
()
>>> fs.tpc_begin(trans)
>>> with open('ablob', 'w') as file:
... _ = file.write('some data')
...
...
@@ -151,7 +152,7 @@ _save_index can fail for large indexes.
>>> import ZODB.utils
>>> fs = ZODB.FileStorage.FileStorage('data.fs')
>>> t =
transaction.begin
()
>>> t =
TransactionMetaData
()
>>> fs.tpc_begin(t)
>>> oid = 0
>>> for i in range(5000):
...
...
src/ZODB/tests/IExternalGC.test
View file @
f0f00357
...
...
@@ -41,7 +41,8 @@ Now we'll use the new deleteObject API to delete the objects. We can't
go
through
the
database
to
do
this
,
so
we
'll have to manage the
transaction ourselves.
>>> txn = transaction.begin()
>>> from ZODB.Connection import TransactionMetaData
>>> txn = TransactionMetaData()
>>> storage.tpc_begin(txn)
>>> storage.deleteObject(oid0, s0, txn)
>>> storage.deleteObject(oid1, s1, txn)
...
...
@@ -116,7 +117,7 @@ isn't current:
>>>
conn
.
root
()[
0
]
.
x
=
1
>>>
transaction
.
commit
()
>>>
txn
=
transaction
.
begin
()
>>>
txn
=
TransactionMetaData
()
>>>
storage
.
tpc_begin
(
txn
)
>>>
storage
.
deleteObject
(
oid
,
bad_serial
,
txn
);
storage
.
tpc_vote
(
txn
)
...
# doctest: +ELLIPSIS
...
...
src/ZODB/tests/PackableStorage.py
View file @
f0f00357
...
...
@@ -144,12 +144,12 @@ class PackableStorageBase:
try
:
load_current
(
self
.
_storage
,
ZERO
)
except
KeyError
:
from
transaction
import
Transaction
from
ZODB.Connection
import
TransactionMetaData
file
=
BytesIO
()
p
=
Pickler
(
file
,
_protocol
)
p
.
dump
((
PersistentMapping
,
None
))
p
.
dump
({
'_container'
:
{}})
t
=
Transaction
()
t
=
TransactionMetaData
()
t
.
description
=
u'initial database creation'
self
.
_storage
.
tpc_begin
(
t
)
self
.
_storage
.
store
(
ZERO
,
None
,
file
.
getvalue
(),
''
,
t
)
...
...
src/ZODB/tests/blob_transaction.txt
View file @
f0f00357
...
...
@@ -377,7 +377,8 @@ If a transaction is aborted in the middle of 2-phase commit, any data
stored are discarded.
>>> olddata, oldserial = blob_storage.load(blob._p_oid, '')
>>> t = transaction.get()
>>> from ZODB.Connection import TransactionMetaData
>>> t = TransactionMetaData()
>>> blob_storage.tpc_begin(t)
>>> with open('blobfile', 'wb') as file:
... _ = file.write(b'This data should go away')
...
...
src/ZODB/tests/util.py
View file @
f0f00357
...
...
@@ -25,6 +25,7 @@ import transaction
import
unittest
import
warnings
import
ZODB.utils
from
ZODB.Connection
import
TransactionMetaData
import
zope.testing.setupstack
from
zope.testing
import
renormalizing
...
...
@@ -161,7 +162,7 @@ def store(storage, oid, value='x', serial=ZODB.utils.z64):
oid
=
ZODB
.
utils
.
p64
(
oid
)
if
not
isinstance
(
serial
,
bytes
):
serial
=
ZODB
.
utils
.
p64
(
serial
)
t
=
transaction
.
get
()
t
=
TransactionMetaData
()
storage
.
tpc_begin
(
t
)
storage
.
store
(
oid
,
serial
,
value
,
''
,
t
)
storage
.
tpc_vote
(
t
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment