Log message for revision 40323:
  Collector #1891:  Backported changes to ZCatalog regression tests, removing 
use of 'whrandom' (and its 'seed' function).
  
  

Changed:
  U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
  U   
Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/regressiontests/loadmail.py
  U   
Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/regressiontests/regressionCatalog.py

-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt       2005-11-22 16:12:59 UTC 
(rev 40322)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt       2005-11-22 16:20:50 UTC 
(rev 40323)
@@ -26,6 +26,9 @@
 
     Bugs Fixed
 
+      - Collector #1891:  Backported changes to ZCatalog regression
+        tests, removing use of 'whrandom' (and its 'seed' function).
+
       - Collector #1621, #1894:  Added BBB alias for 'whrandom'
         in AccessControl/DTML.py and RestrictedPython/Utilities.py.  The
         alias will be removed in Zope 2.10.

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/regressiontests/loadmail.py
===================================================================
--- 
Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/regressiontests/loadmail.py
      2005-11-22 16:12:59 UTC (rev 40322)
+++ 
Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/regressiontests/loadmail.py
      2005-11-22 16:20:50 UTC (rev 40323)
@@ -116,8 +116,7 @@
 import mailbox, time, sys, os, string
 sys.path.insert(0, '.')
 
-import whrandom
-whrandom.seed(1,2,3)
+import random
 
 from string import strip, find, split, lower, atoi
 from urllib import quote
@@ -208,7 +207,7 @@
 def loadinc(name, mb, f, max=99999999, wait=1):
     from ZODB.POSException import ConflictError
     from time import sleep
-    from whrandom import uniform
+    from random import uniform
     import Zope2, sys
     rconflicts=wconflicts=0
 
@@ -607,28 +606,28 @@
 from ZODB.utils import u64
 
 def incedit(edits, wait, ndel=20, nins=20):
-    import Zope2, whrandom, string, time
+    import Zope2, random, string, time
     from ZODB.POSException import ConflictError
 
     rconflicts=wconflicts=0
     did=str(edits.pop())
     while edits:
-        if wait: time.sleep(whrandom.uniform(0,wait))
+        if wait: time.sleep(random.uniform(0,wait))
         jar=Zope2.DB.open()
         app=jar.root()['Application']
         doc=getattr(app.mail, did)
 
         text=string.split(doc.raw)
 
-        n=whrandom.randint(0,ndel*2)
+        n=random.randint(0,ndel*2)
         for j in range(n):
             if len(text) < 2: break
-            j=whrandom.randint(0,len(text)-1)
+            j=random.randint(0,len(text)-1)
             #del text[j]
 
-        n=whrandom.randint(0,nins*2)
+        n=random.randint(0,nins*2)
         for j in range(n):
-            word=whrandom.choice(words)
+            word=random.choice(words)
             text.append(word)
 
         doc.raw=string.join(text)
@@ -690,7 +689,7 @@
                 print c, r
         edits=[0]
         while len(edits) <= nedit:
-            edit=whrandom.randint(0, number_of_messages)
+            edit=random.randint(0, number_of_messages)
             if not alledits.has_key(edit):
                 alledits[edit]=1
                 edits.append(edit)

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/regressiontests/regressionCatalog.py
===================================================================
--- 
Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/regressiontests/regressionCatalog.py
     2005-11-22 16:12:59 UTC (rev 40322)
+++ 
Zope/branches/Zope-2_8-branch/lib/python/Products/ZCatalog/regressiontests/regressionCatalog.py
     2005-11-22 16:20:50 UTC (rev 40323)
@@ -28,7 +28,7 @@
 import keywords
 
 
-import getopt,whrandom,time,string,mailbox,rfc822
+import getopt,random,time,string,mailbox,rfc822
 import unittest_patched as unittest
 
 # maximum number of files to read for the test suite
@@ -380,7 +380,7 @@
 
         rg = []
         for i in range(searchIterations):
-            m = whrandom.randint(0,10000)
+            m = random.randint(0,10000)
             n = m + 200
             rg.append((m,n))
 
@@ -412,7 +412,7 @@
 
         rg = []
         for i in range(len(self.keywords)):
-            m = whrandom.randint(0,10000)
+            m = random.randint(0,10000)
             n = m + 200
             rg.append( (m,n) )
 
@@ -448,8 +448,7 @@
         msgs = self.setupUpdatesMethod(kw["numUpdates"])
         keys = msgs.keys()
 
-        rdgen = whrandom.whrandom()
-        rdgen.seed(int(time.time()) % 256,int(time.time()) % 
256,int(time.time()) % 256)
+        rdgen = random.Random()
 
         env = self.th_setup()
 

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to