Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
persistent
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
persistent
Commits
b42cb77a
Commit
b42cb77a
authored
Jun 29, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor legacy tests to cover both C and Python implementations.
parent
dbecf225
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
6 deletions
+36
-6
persistent/tests/testPersistent.py
persistent/tests/testPersistent.py
+36
-6
No files found.
persistent/tests/testPersistent.py
View file @
b42cb77a
...
@@ -15,19 +15,19 @@ import unittest
...
@@ -15,19 +15,19 @@ import unittest
Picklable
=
None
# avoid global import of Persistent; updated later
Picklable
=
None
# avoid global import of Persistent; updated later
class
PersistenceTest
(
unittest
.
TestCase
):
class
_Base
(
object
):
def
_makeOne
(
self
):
def
_makeOne
(
self
):
from
persistent
import
Persistent
class
P
(
self
.
_getTargetClass
()):
class
P
(
Persistent
):
pass
pass
return
P
()
return
P
()
def
_makeJar
(
self
):
def
_makeJar
(
self
):
from
persistent.tests.utils
import
ResettingJar
from
persistent.tests.utils
import
ResettingJar
return
ResettingJar
()
jar
=
ResettingJar
()
jar
.
cache
=
jar
.
_cache
=
self
.
_makeCache
(
jar
)
return
jar
def
test_oid_initial_value
(
self
):
def
test_oid_initial_value
(
self
):
obj
=
self
.
_makeOne
()
obj
=
self
.
_makeOne
()
...
@@ -316,6 +316,36 @@ class PersistenceTest(unittest.TestCase):
...
@@ -316,6 +316,36 @@ class PersistenceTest(unittest.TestCase):
# TODO: Need to decide how __setattr__ and __delattr__ should work,
# TODO: Need to decide how __setattr__ and __delattr__ should work,
# then write tests.
# then write tests.
class
PythonPersistentTests
(
unittest
.
TestCase
,
_Base
):
def
_getTargetClass
(
self
):
from
persistent.persistence
import
Persistent
return
Persistent
def
_makeCache
(
self
,
jar
):
from
persistent.picklecache
import
PickleCache
return
PickleCache
(
jar
)
_add_to_suite
=
[
PythonPersistentTests
]
try
:
import
persistent.cPersistence
except
ImportError
:
pass
else
:
class
CPersistentTests
(
unittest
.
TestCase
,
_Base
):
def
_getTargetClass
(
self
):
from
persistent.cPersistence
import
Persistent
return
Persistent
def
_makeCache
(
self
,
jar
):
from
persistent.cPickleCache
import
PickleCache
return
PickleCache
(
jar
)
_add_to_suite
.
append
(
CPersistentTests
)
def
test_suite
():
def
test_suite
():
return
unittest
.
makeSuite
(
PersistenceTest
)
return
unittest
.
TestSuite
((
[
unittest
.
makeSuite
(
x
)
for
x
in
_add_to_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