Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
b731a65d
Commit
b731a65d
authored
Jun 12, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove uses of random from cache tests.
parent
8f44f0fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
src/ZODB/tests/testCache.py
src/ZODB/tests/testCache.py
+6
-10
No files found.
src/ZODB/tests/testCache.py
View file @
b731a65d
...
@@ -6,7 +6,6 @@ objects in memory under the assumption that they may be used again.
...
@@ -6,7 +6,6 @@ objects in memory under the assumption that they may be used again.
"""
"""
from
__future__
import
nested_scopes
from
__future__
import
nested_scopes
import
random
import
time
import
time
import
types
import
types
import
unittest
import
unittest
...
@@ -34,8 +33,6 @@ class CacheTestBase(unittest.TestCase):
...
@@ -34,8 +33,6 @@ class CacheTestBase(unittest.TestCase):
conn
.
close
()
conn
.
close
()
self
.
db
.
close
()
self
.
db
.
close
()
NUM_COLLECTIONS
=
10
MAX_OBJECTS
=
100
CACHE_SIZE
=
20
CACHE_SIZE
=
20
def
noodle_new_connection
(
self
):
def
noodle_new_connection
(
self
):
...
@@ -48,17 +45,16 @@ class CacheTestBase(unittest.TestCase):
...
@@ -48,17 +45,16 @@ class CacheTestBase(unittest.TestCase):
def
noodle_connection
(
self
,
c
):
def
noodle_connection
(
self
,
c
):
r
=
c
.
root
()
r
=
c
.
root
()
i
=
random
.
randrange
(
0
,
self
.
NUM_COLLECTIONS
)
i
=
len
(
self
.
conns
)
d
=
r
.
get
(
i
)
d
=
r
.
get
(
i
)
if
d
is
None
:
if
d
is
None
:
d
=
r
[
i
]
=
PersistentMapping
()
d
=
r
[
i
]
=
PersistentMapping
()
get_transaction
().
commit
()
get_transaction
().
commit
()
for
i
in
range
(
random
.
randrange
(
10
,
20
)):
for
i
in
range
(
15
):
j
=
random
.
randrange
(
0
,
self
.
MAX_OBJECTS
)
o
=
d
.
get
(
i
)
o
=
d
.
get
(
j
)
if
o
is
None
:
if
o
is
None
:
o
=
d
[
j
]
=
MinPO
(
j
)
o
=
d
[
i
]
=
MinPO
(
i
)
o
.
value
+=
1
o
.
value
+=
1
get_transaction
().
commit
()
get_transaction
().
commit
()
...
@@ -196,11 +192,11 @@ class LRUCacheTests(CacheTestBase):
...
@@ -196,11 +192,11 @@ class LRUCacheTests(CacheTestBase):
self
.
noodle_new_connection
()
self
.
noodle_new_connection
()
for
klass
,
count
in
self
.
db
.
cacheDetail
():
for
klass
,
count
in
self
.
db
.
cacheDetail
():
if
klass
.
endswith
(
'MinPO'
):
self
.
assertEqual
(
count
,
CONNS
*
CACHE_SIZE
)
if
klass
.
endswith
(
'PersistentMapping'
):
if
klass
.
endswith
(
'PersistentMapping'
):
# one root per connection
# one root per connection
self
.
assertEqual
(
count
,
CONNS
)
self
.
assertEqual
(
count
,
CONNS
)
if
klass
.
endswith
(
'MinPO'
):
self
.
assertEqual
(
count
,
CONNS
*
CACHE_SIZE
)
for
details
in
self
.
db
.
cacheExtremeDetail
():
for
details
in
self
.
db
.
cacheExtremeDetail
():
# one dict per object. keys:
# one dict per object. keys:
...
...
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