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
83f054fa
Commit
83f054fa
authored
Jun 07, 2005
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid use of the deprecated whrandom module
parent
ee368cf7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
lib/python/Products/ZCatalog/regressiontests/loadmail.py
lib/python/Products/ZCatalog/regressiontests/loadmail.py
+9
-10
lib/python/Products/ZCatalog/regressiontests/regressionCatalog.py
...on/Products/ZCatalog/regressiontests/regressionCatalog.py
+4
-5
No files found.
lib/python/Products/ZCatalog/regressiontests/loadmail.py
View file @
83f054fa
...
@@ -116,8 +116,7 @@ import getopt
...
@@ -116,8 +116,7 @@ import getopt
import
mailbox
,
time
,
sys
,
os
,
string
import
mailbox
,
time
,
sys
,
os
,
string
sys
.
path
.
insert
(
0
,
'.'
)
sys
.
path
.
insert
(
0
,
'.'
)
import
whrandom
import
random
whrandom
.
seed
(
1
,
2
,
3
)
from
string
import
strip
,
find
,
split
,
lower
,
atoi
from
string
import
strip
,
find
,
split
,
lower
,
atoi
from
urllib
import
quote
from
urllib
import
quote
...
@@ -208,7 +207,7 @@ def loadmail(dest, name, mbox, max=-1):
...
@@ -208,7 +207,7 @@ def loadmail(dest, name, mbox, max=-1):
def
loadinc
(
name
,
mb
,
f
,
max
=
99999999
,
wait
=
1
):
def
loadinc
(
name
,
mb
,
f
,
max
=
99999999
,
wait
=
1
):
from
ZODB.POSException
import
ConflictError
from
ZODB.POSException
import
ConflictError
from
time
import
sleep
from
time
import
sleep
from
wh
random
import
uniform
from
random
import
uniform
import
Zope2
,
sys
import
Zope2
,
sys
rconflicts
=
wconflicts
=
0
rconflicts
=
wconflicts
=
0
...
@@ -607,28 +606,28 @@ words=['banishment', 'indirectly', 'imprecise', 'peeks',
...
@@ -607,28 +606,28 @@ words=['banishment', 'indirectly', 'imprecise', 'peeks',
from
ZODB.utils
import
u64
from
ZODB.utils
import
u64
def
incedit
(
edits
,
wait
,
ndel
=
20
,
nins
=
20
):
def
incedit
(
edits
,
wait
,
ndel
=
20
,
nins
=
20
):
import
Zope2
,
wh
random
,
string
,
time
import
Zope2
,
random
,
string
,
time
from
ZODB.POSException
import
ConflictError
from
ZODB.POSException
import
ConflictError
rconflicts
=
wconflicts
=
0
rconflicts
=
wconflicts
=
0
did
=
str
(
edits
.
pop
())
did
=
str
(
edits
.
pop
())
while
edits
:
while
edits
:
if
wait
:
time
.
sleep
(
wh
random
.
uniform
(
0
,
wait
))
if
wait
:
time
.
sleep
(
random
.
uniform
(
0
,
wait
))
jar
=
Zope2
.
DB
.
open
()
jar
=
Zope2
.
DB
.
open
()
app
=
jar
.
root
()[
'Application'
]
app
=
jar
.
root
()[
'Application'
]
doc
=
getattr
(
app
.
mail
,
did
)
doc
=
getattr
(
app
.
mail
,
did
)
text
=
string
.
split
(
doc
.
raw
)
text
=
string
.
split
(
doc
.
raw
)
n
=
wh
random
.
randint
(
0
,
ndel
*
2
)
n
=
random
.
randint
(
0
,
ndel
*
2
)
for
j
in
range
(
n
):
for
j
in
range
(
n
):
if
len
(
text
)
<
2
:
break
if
len
(
text
)
<
2
:
break
j
=
wh
random
.
randint
(
0
,
len
(
text
)
-
1
)
j
=
random
.
randint
(
0
,
len
(
text
)
-
1
)
#del text[j]
#del text[j]
n
=
wh
random
.
randint
(
0
,
nins
*
2
)
n
=
random
.
randint
(
0
,
nins
*
2
)
for
j
in
range
(
n
):
for
j
in
range
(
n
):
word
=
wh
random
.
choice
(
words
)
word
=
random
.
choice
(
words
)
text
.
append
(
word
)
text
.
append
(
word
)
doc
.
raw
=
string
.
join
(
text
)
doc
.
raw
=
string
.
join
(
text
)
...
@@ -690,7 +689,7 @@ def edit():
...
@@ -690,7 +689,7 @@ def edit():
print
c
,
r
print
c
,
r
edits
=
[
0
]
edits
=
[
0
]
while
len
(
edits
)
<=
nedit
:
while
len
(
edits
)
<=
nedit
:
edit
=
wh
random
.
randint
(
0
,
number_of_messages
)
edit
=
random
.
randint
(
0
,
number_of_messages
)
if
not
alledits
.
has_key
(
edit
):
if
not
alledits
.
has_key
(
edit
):
alledits
[
edit
]
=
1
alledits
[
edit
]
=
1
edits
.
append
(
edit
)
edits
.
append
(
edit
)
...
...
lib/python/Products/ZCatalog/regressiontests/regressionCatalog.py
View file @
83f054fa
...
@@ -28,7 +28,7 @@ from Testing import dispatcher
...
@@ -28,7 +28,7 @@ from Testing import dispatcher
import
keywords
import
keywords
import
getopt
,
wh
random
,
time
,
string
,
mailbox
,
rfc822
import
getopt
,
random
,
time
,
string
,
mailbox
,
rfc822
import
unittest_patched
as
unittest
import
unittest_patched
as
unittest
# maximum number of files to read for the test suite
# maximum number of files to read for the test suite
...
@@ -380,7 +380,7 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
...
@@ -380,7 +380,7 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
rg
=
[]
rg
=
[]
for
i
in
range
(
searchIterations
):
for
i
in
range
(
searchIterations
):
m
=
wh
random
.
randint
(
0
,
10000
)
m
=
random
.
randint
(
0
,
10000
)
n
=
m
+
200
n
=
m
+
200
rg
.
append
((
m
,
n
))
rg
.
append
((
m
,
n
))
...
@@ -412,7 +412,7 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
...
@@ -412,7 +412,7 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
rg
=
[]
rg
=
[]
for
i
in
range
(
len
(
self
.
keywords
)):
for
i
in
range
(
len
(
self
.
keywords
)):
m
=
wh
random
.
randint
(
0
,
10000
)
m
=
random
.
randint
(
0
,
10000
)
n
=
m
+
200
n
=
m
+
200
rg
.
append
(
(
m
,
n
)
)
rg
.
append
(
(
m
,
n
)
)
...
@@ -448,8 +448,7 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
...
@@ -448,8 +448,7 @@ class testSearches(dispatcher.Dispatcher,unittest.TestCase):
msgs
=
self
.
setupUpdatesMethod
(
kw
[
"numUpdates"
])
msgs
=
self
.
setupUpdatesMethod
(
kw
[
"numUpdates"
])
keys
=
msgs
.
keys
()
keys
=
msgs
.
keys
()
rdgen
=
whrandom
.
whrandom
()
rdgen
=
random
.
Random
()
rdgen
.
seed
(
int
(
time
.
time
())
%
256
,
int
(
time
.
time
())
%
256
,
int
(
time
.
time
())
%
256
)
env
=
self
.
th_setup
()
env
=
self
.
th_setup
()
...
...
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