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
602b73b1
Commit
602b73b1
authored
Apr 11, 2002
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the random module instead of the deprecated whrandom module.
parent
f0f81d86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
lib/python/OFS/tests/testRanges.py
lib/python/OFS/tests/testRanges.py
+2
-2
lib/python/Products/Sessions/stresstests/stresstestMultiThread.py
...on/Products/Sessions/stresstests/stresstestMultiThread.py
+3
-3
No files found.
lib/python/OFS/tests/testRanges.py
View file @
602b73b1
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
##############################################################################
##############################################################################
import
os
,
sys
,
unittest
import
os
,
sys
,
unittest
import
string
,
wh
random
,
cStringIO
,
time
,
re
import
string
,
random
,
cStringIO
,
time
,
re
import
ZODB
import
ZODB
from
OFS.Application
import
Application
from
OFS.Application
import
Application
from
OFS.Folder
import
manage_addFolder
from
OFS.Folder
import
manage_addFolder
...
@@ -37,7 +37,7 @@ def createBigFile():
...
@@ -37,7 +37,7 @@ def createBigFile():
file
=
cStringIO
.
StringIO
()
file
=
cStringIO
.
StringIO
()
def
addLetter
(
x
,
add
=
file
.
write
,
l
=
string
.
letters
,
def
addLetter
(
x
,
add
=
file
.
write
,
l
=
string
.
letters
,
c
=
wh
random
.
choice
):
c
=
random
.
choice
):
add
(
c
(
l
))
add
(
c
(
l
))
filter
(
addLetter
,
range
(
size
))
filter
(
addLetter
,
range
(
size
))
...
...
lib/python/Products/Sessions/stresstests/stresstestMultiThread.py
View file @
602b73b1
...
@@ -27,7 +27,7 @@ from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
...
@@ -27,7 +27,7 @@ from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
from
ZODB.POSException
import
InvalidObjectReference
,
ConflictError
from
ZODB.POSException
import
InvalidObjectReference
,
ConflictError
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
unittest
import
TestCase
,
TestSuite
,
TextTestRunner
,
makeSuite
from
unittest
import
TestCase
,
TestSuite
,
TextTestRunner
,
makeSuite
import
time
,
threading
,
wh
random
import
time
,
threading
,
random
from
cPickle
import
UnpickleableError
from
cPickle
import
UnpickleableError
from
ZODB.DemoStorage
import
DemoStorage
from
ZODB.DemoStorage
import
DemoStorage
from
OFS.Application
import
Application
from
OFS.Application
import
Application
...
@@ -185,7 +185,7 @@ class ReaderThread(BaseReaderWriter):
...
@@ -185,7 +185,7 @@ class ReaderThread(BaseReaderWriter):
data
=
session_data_manager
.
getSessionData
()
data
=
session_data_manager
.
getSessionData
()
if
not
data
.
has_key
(
t
):
if
not
data
.
has_key
(
t
):
self
.
out
.
append
(
1
)
self
.
out
.
append
(
1
)
time
.
sleep
(
wh
random
.
choice
(
range
(
3
)))
time
.
sleep
(
random
.
choice
(
range
(
3
)))
get_transaction
().
commit
()
get_transaction
().
commit
()
class
WriterThread
(
BaseReaderWriter
):
class
WriterThread
(
BaseReaderWriter
):
...
@@ -194,7 +194,7 @@ class WriterThread(BaseReaderWriter):
...
@@ -194,7 +194,7 @@ class WriterThread(BaseReaderWriter):
for
i
in
range
(
self
.
iters
):
for
i
in
range
(
self
.
iters
):
data
=
session_data_manager
.
getSessionData
()
data
=
session_data_manager
.
getSessionData
()
data
[
time
.
time
()]
=
1
data
[
time
.
time
()]
=
1
n
=
wh
random
.
choice
(
range
(
3
))
n
=
random
.
choice
(
range
(
3
))
time
.
sleep
(
n
)
time
.
sleep
(
n
)
if
n
%
2
==
0
:
if
n
%
2
==
0
:
get_transaction
().
commit
()
get_transaction
().
commit
()
...
...
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