Commit 602b73b1 authored by Fred Drake's avatar Fred Drake

Use the random module instead of the deprecated whrandom module.

parent f0f81d86
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
############################################################################## ##############################################################################
import os, sys, unittest import os, sys, unittest
import string, whrandom, 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=whrandom.choice): c=random.choice):
add(c(l)) add(c(l))
filter(addLetter, range(size)) filter(addLetter, range(size))
......
...@@ -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, whrandom 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(whrandom.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 = whrandom.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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment