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
c5e32fb1
Commit
c5e32fb1
authored
Apr 02, 2001
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out commonality between the Minimal and Full tests.
parent
715a9173
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
45 deletions
+19
-45
lib/python/BDBStorage/tests/test_create.py
lib/python/BDBStorage/tests/test_create.py
+14
-31
lib/python/BDBStorage/tests/test_virgin.py
lib/python/BDBStorage/tests/test_virgin.py
+5
-14
No files found.
lib/python/BDBStorage/tests/test_create.py
View file @
c5e32fb1
...
...
@@ -6,16 +6,15 @@ import unittest
class
Minimal
BaseFramework
(
unittest
.
TestCase
):
class
BaseFramework
(
unittest
.
TestCase
):
def
setUp
(
self
):
import
Minimal
from
ZODB
import
DB
self
.
_dbhome
=
'test-db'
os
.
mkdir
(
self
.
_dbhome
)
try
:
self
.
_storage
=
Minimal
.
Minimal
(
self
.
_dbhome
)
self
.
_storage
=
self
.
ConcreteStorage
(
self
.
_dbhome
)
self
.
_db
=
DB
(
self
.
_storage
)
self
.
_conn
=
self
.
_db
.
open
()
self
.
_root
=
self
.
_conn
.
root
()
...
...
@@ -27,44 +26,28 @@ class MinimalBaseFramework(unittest.TestCase):
for
file
in
os
.
listdir
(
self
.
_dbhome
):
os
.
unlink
(
os
.
path
.
join
(
self
.
_dbhome
,
file
))
os
.
removedirs
(
self
.
_dbhome
)
def
checkDBHomeExists
(
self
):
assert
os
.
path
.
isdir
(
self
.
_dbhome
)
class
FullBaseFramework
(
unittest
.
TestCase
):
def
setUp
(
self
):
import
Full
from
ZODB
import
DB
self
.
_dbhome
=
'test-db'
os
.
mkdir
(
self
.
_dbhome
)
try
:
self
.
_storage
=
Full
.
Full
(
self
.
_dbhome
)
self
.
_db
=
DB
(
self
.
_storage
)
self
.
_conn
=
self
.
_db
.
open
()
self
.
_root
=
self
.
_conn
.
root
()
except
:
self
.
tearDown
()
raise
def
tearDown
(
self
):
for
file
in
os
.
listdir
(
self
.
_dbhome
):
os
.
unlink
(
os
.
path
.
join
(
self
.
_dbhome
,
file
))
os
.
removedirs
(
self
.
_dbhome
)
class
MinimalBaseFramework
(
BaseFramework
):
import
Minimal
ConcreteStorage
=
Minimal
.
Minimal
class
MinimalDBHomeTest
(
MinimalBaseFramework
):
def
checkDBHomeExists
(
self
):
"""Minimal: Database creation w/ explicit db_home"""
assert
os
.
path
.
isdir
(
self
.
_dbhome
)
pass
class
FullBaseFramework
(
BaseFramework
):
import
Full
ConcreteStorage
=
Full
.
Full
class
FullDBHomeTest
(
FullBaseFramework
):
def
checkDBHomeExists
(
self
):
"""Full: Database creation w/ explicit db_home"""
assert
os
.
path
.
isdir
(
self
.
_dbhome
)
pass
...
...
lib/python/BDBStorage/tests/test_virgin.py
View file @
c5e32fb1
...
...
@@ -5,13 +5,11 @@ import test_create
class
FullNewInsertsTest
(
test_create
.
FullBaseFramework
)
:
class
BaseInsertMixin
:
def
checkIsEmpty
(
self
):
"""Full: Newly created database should be empty"""
assert
not
self
.
_root
.
has_key
(
'names'
)
def
checkNewInserts
(
self
):
"""Full: Commiting on a newly created database"""
from
Persistence
import
PersistentMapping
self
.
_root
[
'names'
]
=
names
=
PersistentMapping
()
...
...
@@ -21,19 +19,12 @@ class FullNewInsertsTest(test_create.FullBaseFramework):
class
MinimalNewInsertsTest
(
test_create
.
MinimalBaseFramework
):
def
checkIsEmpty
(
self
):
"""Minimal: Newly created database is empty"""
assert
not
self
.
_root
.
has_key
(
'names'
)
class
FullNewInsertsTest
(
test_create
.
FullBaseFramework
,
BaseInsertMixin
):
pass
def
checkNewInserts
(
self
):
"""Minimal: Committing on a newly created database"""
from
Persistence
import
PersistentMapping
self
.
_root
[
'names'
]
=
names
=
PersistentMapping
()
names
[
'Warsaw'
]
=
'Barry'
names
[
'Hylton'
]
=
'Jeremy'
get_transaction
().
commit
()
class
MinimalNewInsertsTest
(
test_create
.
MinimalBaseFramework
,
BaseInsertMixin
):
pass
...
...
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