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
f0b26152
Commit
f0b26152
authored
Feb 14, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give up on an argument lost 10 years ago.
parent
266cadf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
src/ZODB/tests/testCache.py
src/ZODB/tests/testCache.py
+19
-19
No files found.
src/ZODB/tests/testCache.py
View file @
f0b26152
...
...
@@ -96,12 +96,12 @@ class DBMethods(CacheTestBase):
for
i
in
range
(
4
):
self
.
noodle_new_connection
()
def
check
CacheDetail
(
self
):
def
test
CacheDetail
(
self
):
for
name
,
count
in
self
.
db
.
cacheDetail
():
self
.
assertEqual
(
isinstance
(
name
,
str
),
True
)
self
.
assertEqual
(
isinstance
(
count
,
int
),
True
)
def
check
CacheExtremeDetail
(
self
):
def
test
CacheExtremeDetail
(
self
):
expected
=
[
'conn_no'
,
'id'
,
'oid'
,
'rc'
,
'klass'
,
'state'
]
for
dict
in
self
.
db
.
cacheExtremeDetail
():
for
k
,
v
in
dict
.
items
():
...
...
@@ -110,19 +110,19 @@ class DBMethods(CacheTestBase):
# TODO: not really sure how to do a black box test of the cache.
# Should the full sweep and minimize calls always remove things?
def
check
FullSweep
(
self
):
def
test
FullSweep
(
self
):
old_size
=
self
.
db
.
cacheSize
()
self
.
db
.
cacheFullSweep
()
new_size
=
self
.
db
.
cacheSize
()
self
.
assert_
(
new_size
<
old_size
,
"%s < %s"
%
(
old_size
,
new_size
))
def
check
Minimize
(
self
):
def
test
Minimize
(
self
):
old_size
=
self
.
db
.
cacheSize
()
self
.
db
.
cacheMinimize
()
new_size
=
self
.
db
.
cacheSize
()
self
.
assert_
(
new_size
<
old_size
,
"%s < %s"
%
(
old_size
,
new_size
))
def
check
MinimizeTerminates
(
self
):
def
test
MinimizeTerminates
(
self
):
# This is tricky. cPickleCache had a case where it could get into
# an infinite loop, but we don't want the test suite to hang
# if this bug reappears. So this test spawns a thread to run the
...
...
@@ -179,18 +179,18 @@ class DBMethods(CacheTestBase):
# connection and database call it internally.
# Same for the get and invalidate methods.
def
check
LRUitems
(
self
):
def
test
LRUitems
(
self
):
# get a cache
c
=
self
.
conns
[
0
].
_cache
c
.
lru_items
()
def
check
ClassItems
(
self
):
def
test
ClassItems
(
self
):
c
=
self
.
conns
[
0
].
_cache
c
.
klass_items
()
class
LRUCacheTests
(
CacheTestBase
):
def
check
LRU
(
self
):
def
test
LRU
(
self
):
# verify the LRU behavior of the cache
dataset_size
=
5
CACHE_SIZE
=
dataset_size
*
2
+
1
...
...
@@ -229,7 +229,7 @@ class LRUCacheTests(CacheTestBase):
# the root, depending on precise order of access. We do
# not bother to check this
def
check
Size
(
self
):
def
test
Size
(
self
):
self
.
assertEqual
(
self
.
db
.
cacheSize
(),
0
)
self
.
assertEqual
(
self
.
db
.
cacheDetailSize
(),
[])
...
...
@@ -253,7 +253,7 @@ class LRUCacheTests(CacheTestBase):
#self.assertEquals(d['size'], CACHE_SIZE)
def
check
Detail
(
self
):
def
test
Detail
(
self
):
CACHE_SIZE
=
10
self
.
db
.
setCacheSize
(
CACHE_SIZE
)
...
...
@@ -314,7 +314,7 @@ class CacheErrors(unittest.TestCase):
self
.
jar
=
StubDataManager
()
self
.
cache
=
PickleCache
(
self
.
jar
)
def
check
GetBogusKey
(
self
):
def
test
GetBogusKey
(
self
):
self
.
assertEqual
(
self
.
cache
.
get
(
p64
(
0
)),
None
)
try
:
self
.
cache
[
12
]
...
...
@@ -335,7 +335,7 @@ class CacheErrors(unittest.TestCase):
else
:
self
.
fail
(
"expected TypeError"
)
def
check
BogusObject
(
self
):
def
test
BogusObject
(
self
):
def
add
(
key
,
obj
):
self
.
cache
[
key
]
=
obj
...
...
@@ -366,7 +366,7 @@ class CacheErrors(unittest.TestCase):
self
.
assertEqual
(
sys
.
getrefcount
(
None
),
nones
)
def
check
TwoCaches
(
self
):
def
test
TwoCaches
(
self
):
jar2
=
StubDataManager
()
cache2
=
PickleCache
(
jar2
)
...
...
@@ -383,7 +383,7 @@ class CacheErrors(unittest.TestCase):
else
:
self
.
fail
(
"expected ValueError because object already in cache"
)
def
check
ReadOnlyAttrsWhenCached
(
self
):
def
test
ReadOnlyAttrsWhenCached
(
self
):
o
=
StubObject
()
key
=
o
.
_p_oid
=
p64
(
1
)
o
.
_p_jar
=
self
.
jar
...
...
@@ -401,7 +401,7 @@ class CacheErrors(unittest.TestCase):
else
:
self
.
fail
(
"expect that you can't delete jar of cached object"
)
def
check
TwoObjsSameOid
(
self
):
def
test
TwoObjsSameOid
(
self
):
# Try to add two distinct objects with the same oid to the cache.
# This has always been an error, but the error message prior to
# ZODB 3.2.6 didn't make sense. This test verifies that (a) an
...
...
@@ -423,7 +423,7 @@ class CacheErrors(unittest.TestCase):
else
:
self
.
fail
(
"two objects with the same oid should have failed"
)
def
check
_basic_cache_size_estimation
():
def
test
_basic_cache_size_estimation
():
"""Make sure the basic accounting is correct:
>>> import ZODB.MappingStorage
...
...
@@ -481,8 +481,8 @@ size correctly:
def
test_suite
():
s
=
unittest
.
makeSuite
(
DBMethods
,
'check'
)
s
.
addTest
(
unittest
.
makeSuite
(
LRUCacheTests
,
'check'
))
s
.
addTest
(
unittest
.
makeSuite
(
CacheErrors
,
'check'
))
s
=
unittest
.
makeSuite
(
DBMethods
)
s
.
addTest
(
unittest
.
makeSuite
(
LRUCacheTests
))
s
.
addTest
(
unittest
.
makeSuite
(
CacheErrors
))
s
.
addTest
(
doctest
.
DocTestSuite
())
return
s
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