Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
b2bd8f8a
Commit
b2bd8f8a
authored
Sep 25, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify tests to refer to savepoints instead of subtransactions
parent
9508ffa6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
24 deletions
+13
-24
src/Testing/ZopeTestCase/testZODBCompat.py
src/Testing/ZopeTestCase/testZODBCompat.py
+13
-24
No files found.
src/Testing/ZopeTestCase/testZODBCompat.py
View file @
b2bd8f8a
...
@@ -13,8 +13,7 @@
...
@@ -13,8 +13,7 @@
"""Tests ZODB behavior in ZopeTestCase
"""Tests ZODB behavior in ZopeTestCase
Demonstrates that cut/copy/paste/clone/rename and import/export
Demonstrates that cut/copy/paste/clone/rename and import/export
work if a subtransaction is committed before performing the respective
work if a savepoint is made before performing the respective operation.
operation.
"""
"""
import
os
import
os
...
@@ -67,7 +66,7 @@ class TestCopyPaste(ZopeTestCase.ZopeTestCase):
...
@@ -67,7 +66,7 @@ class TestCopyPaste(ZopeTestCase.ZopeTestCase):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
self
.
setPermissions
(
cutpaste_permissions
)
self
.
setPermissions
(
cutpaste_permissions
)
self
.
folder
.
addDTMLMethod
(
'doc'
,
file
=
'foo'
)
self
.
folder
.
addDTMLMethod
(
'doc'
,
file
=
'foo'
)
# _p_oids are None until we c
ommit a subtransaction
# _p_oids are None until we c
reate a savepoint
self
.
assertEqual
(
self
.
folder
.
_p_oid
,
None
)
self
.
assertEqual
(
self
.
folder
.
_p_oid
,
None
)
transaction
.
savepoint
(
optimistic
=
True
)
transaction
.
savepoint
(
optimistic
=
True
)
self
.
assertNotEqual
(
self
.
folder
.
_p_oid
,
None
)
self
.
assertNotEqual
(
self
.
folder
.
_p_oid
,
None
)
...
@@ -118,7 +117,7 @@ class TestImportExport(ZopeTestCase.ZopeTestCase):
...
@@ -118,7 +117,7 @@ class TestImportExport(ZopeTestCase.ZopeTestCase):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
self
.
setupLocalEnvironment
()
self
.
setupLocalEnvironment
()
self
.
folder
.
addDTMLMethod
(
'doc'
,
file
=
'foo'
)
self
.
folder
.
addDTMLMethod
(
'doc'
,
file
=
'foo'
)
# _p_oids are None until we c
ommit a subtransaction
# _p_oids are None until we c
reate a savepoint
self
.
assertEqual
(
self
.
folder
.
_p_oid
,
None
)
self
.
assertEqual
(
self
.
folder
.
_p_oid
,
None
)
transaction
.
savepoint
(
optimistic
=
True
)
transaction
.
savepoint
(
optimistic
=
True
)
self
.
assertNotEqual
(
self
.
folder
.
_p_oid
,
None
)
self
.
assertNotEqual
(
self
.
folder
.
_p_oid
,
None
)
...
@@ -143,23 +142,13 @@ class TestImportExport(ZopeTestCase.ZopeTestCase):
...
@@ -143,23 +142,13 @@ class TestImportExport(ZopeTestCase.ZopeTestCase):
def
setupLocalEnvironment
(
self
):
def
setupLocalEnvironment
(
self
):
# Create the 'import' directory
# Create the 'import' directory
os
.
mkdir
(
self
.
import_dir
)
os
.
mkdir
(
self
.
import_dir
)
try
:
import
App.config
import
App.config
config
=
App
.
config
.
getConfiguration
()
except
ImportError
:
self
.
_ih
=
config
.
instancehome
# Modify builtins
config
.
instancehome
=
self
.
local_home
builtins
=
getattr
(
__builtins__
,
'__dict__'
,
__builtins__
)
self
.
_ch
=
config
.
clienthome
self
.
_ih
=
INSTANCE_HOME
config
.
clienthome
=
self
.
import_dir
builtins
[
'INSTANCE_HOME'
]
=
self
.
local_home
App
.
config
.
setConfiguration
(
config
)
self
.
_ch
=
CLIENT_HOME
builtins
[
'CLIENT_HOME'
]
=
self
.
import_dir
else
:
# Zope >= 2.7
config
=
App
.
config
.
getConfiguration
()
self
.
_ih
=
config
.
instancehome
config
.
instancehome
=
self
.
local_home
self
.
_ch
=
config
.
clienthome
config
.
clienthome
=
self
.
import_dir
App
.
config
.
setConfiguration
(
config
)
def
afterClear
(
self
):
def
afterClear
(
self
):
# Remove external resources
# Remove external resources
...
@@ -327,7 +316,7 @@ class TestTransactionAbort(ZopeTestCase.ZopeTestCase):
...
@@ -327,7 +316,7 @@ class TestTransactionAbort(ZopeTestCase.ZopeTestCase):
# The foo attribute is still present
# The foo attribute is still present
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'foo'
))
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'foo'
))
def
testS
ubTransaction
Abort
(
self
):
def
testS
avepoint
Abort
(
self
):
self
.
folder
.
foo
=
1
self
.
folder
.
foo
=
1
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'foo'
))
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'foo'
))
transaction
.
savepoint
(
optimistic
=
True
)
transaction
.
savepoint
(
optimistic
=
True
)
...
@@ -342,7 +331,7 @@ class TestTransactionAbort(ZopeTestCase.ZopeTestCase):
...
@@ -342,7 +331,7 @@ class TestTransactionAbort(ZopeTestCase.ZopeTestCase):
# The _p_foo attribute is still present
# The _p_foo attribute is still present
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'_p_foo'
))
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'_p_foo'
))
def
testS
ubTransaction
AbortPersistent
(
self
):
def
testS
avepoint
AbortPersistent
(
self
):
self
.
folder
.
_p_foo
=
1
self
.
folder
.
_p_foo
=
1
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'_p_foo'
))
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'_p_foo'
))
transaction
.
savepoint
(
optimistic
=
True
)
transaction
.
savepoint
(
optimistic
=
True
)
...
@@ -357,7 +346,7 @@ class TestTransactionAbort(ZopeTestCase.ZopeTestCase):
...
@@ -357,7 +346,7 @@ class TestTransactionAbort(ZopeTestCase.ZopeTestCase):
# The _v_foo attribute is still present
# The _v_foo attribute is still present
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'_v_foo'
))
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'_v_foo'
))
def
testS
ubTransaction
AbortVolatile
(
self
):
def
testS
avepoint
AbortVolatile
(
self
):
self
.
folder
.
_v_foo
=
1
self
.
folder
.
_v_foo
=
1
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'_v_foo'
))
self
.
assertTrue
(
hasattr
(
self
.
folder
,
'_v_foo'
))
transaction
.
savepoint
(
optimistic
=
True
)
transaction
.
savepoint
(
optimistic
=
True
)
...
...
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