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
2bdeec1b
Commit
2bdeec1b
authored
Apr 16, 2001
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked to use the ZODBTestBase class and the new mixin style of
creating test classes.
parent
18f51531
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
34 deletions
+20
-34
lib/python/BDBStorage/tests/test_virgin.py
lib/python/BDBStorage/tests/test_virgin.py
+12
-12
lib/python/BDBStorage/tests/test_zodb_simple.py
lib/python/BDBStorage/tests/test_zodb_simple.py
+8
-22
No files found.
lib/python/BDBStorage/tests/test_virgin.py
View file @
2bdeec1b
# Test creation of a brand new database, and insertion of root objects.
import
unittest
import
test_create
from
ZODBTestBase
import
ZODBTestBase
from
Persistence
import
PersistentMapping
class
Base
InsertMixin
:
class
InsertMixin
:
def
checkIsEmpty
(
self
):
assert
not
self
.
_root
.
has_key
(
'names'
)
def
checkNewInserts
(
self
):
from
Persistence
import
PersistentMapping
self
.
_root
[
'names'
]
=
names
=
PersistentMapping
()
names
[
'Warsaw'
]
=
'Barry'
names
[
'Hylton'
]
=
'Jeremy'
...
...
@@ -19,21 +19,21 @@ class BaseInsertMixin:
class
FullNewInsertsTest
(
test_create
.
FullBaseFramework
,
BaseInsertMixin
):
pass
class
FullNewInsertsTest
(
ZODBTestBase
,
InsertMixin
):
import
Full
ConcreteStorage
=
Full
.
Full
class
MinimalNewInsertsTest
(
test_create
.
MinimalBaseFramework
,
BaseInsertMixin
):
pass
class
MinimalNewInsertsTest
(
ZODBTestBase
,
InsertMixin
):
import
Minimal
ConcreteStorage
=
Minimal
.
Minimal
def
suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
MinimalNewInsertsTest
(
'checkIsEmpty'
))
suite
.
addTest
(
MinimalNewInsertsTest
(
'checkNewInserts'
))
suite
.
addTest
(
FullNewInsertsTest
(
'checkIsEmpty'
))
suite
.
addTest
(
FullNewInsertsTest
(
'checkNewInserts'
))
suite
.
addTest
(
unittest
.
makeSuite
(
MinimalNewInsertsTest
,
'check'
))
suite
.
addTest
(
unittest
.
makeSuite
(
FullNewInsertsTest
,
'check'
))
return
suite
...
...
lib/python/BDBStorage/tests/test_zodb_simple.py
View file @
2bdeec1b
...
...
@@ -2,18 +2,16 @@
# storages, like transaction aborts and commits, changing objects, etc.
# Doesn't test undo, versions, or packing.
import
os
import
errno
import
time
import
unittest
import
test_create
from
ZODBTestBase
import
ZODBTestBase
from
Persistence
import
PersistentMapping
class
CommitAndRead
(
test_create
.
BaseFramework
)
:
class
CommitAndRead
:
def
checkCommit
(
self
):
from
Persistence
import
PersistentMapping
assert
not
self
.
_root
names
=
self
.
_root
[
'names'
]
=
PersistentMapping
()
names
[
'Warsaw'
]
=
'Barry'
...
...
@@ -52,12 +50,12 @@ class CommitAndRead(test_create.BaseFramework):
class
MinimalCommitAndRead
(
CommitAndRead
):
class
MinimalCommitAndRead
(
ZODBTestBase
,
CommitAndRead
):
import
Minimal
ConcreteStorage
=
Minimal
.
Minimal
class
FullCommitAndRead
(
CommitAndRead
):
class
FullCommitAndRead
(
ZODBTestBase
,
CommitAndRead
):
import
Full
ConcreteStorage
=
Full
.
Full
...
...
@@ -65,20 +63,8 @@ class FullCommitAndRead(CommitAndRead):
def
suite
():
suite
=
unittest
.
TestSuite
()
# On the Minimal storage
suite
.
addTest
(
MinimalCommitAndRead
(
'checkCommit'
))
suite
.
addTest
(
MinimalCommitAndRead
(
'checkReadAfterCommit'
))
suite
.
addTest
(
MinimalCommitAndRead
(
'checkAbortAfterRead'
))
suite
.
addTest
(
MinimalCommitAndRead
(
'checkReadAfterCommit'
))
for
i
in
range
(
5
):
suite
.
addTest
(
MinimalCommitAndRead
(
'checkChangingCommits'
))
# On the Full storage
suite
.
addTest
(
FullCommitAndRead
(
'checkCommit'
))
suite
.
addTest
(
FullCommitAndRead
(
'checkReadAfterCommit'
))
suite
.
addTest
(
FullCommitAndRead
(
'checkAbortAfterRead'
))
suite
.
addTest
(
FullCommitAndRead
(
'checkReadAfterCommit'
))
for
i
in
range
(
5
):
suite
.
addTest
(
FullCommitAndRead
(
'checkChangingCommits'
))
suite
.
addTest
(
unittest
.
makeSuite
(
MinimalCommitAndRead
,
'check'
))
suite
.
addTest
(
unittest
.
makeSuite
(
FullCommitAndRead
,
'check'
))
return
suite
...
...
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