Commit 366414ae authored by Albertas Agejevas's avatar Albertas Agejevas

Fix stats tests. Need random2.

parent 4d9871f6
......@@ -71,7 +71,7 @@ def alltests():
suite.addTest(mod.test_suite())
return suite
tests_require = ['zope.testing', 'manuel']
tests_require = ['zope.testing', 'manuel', 'random2']
long_description = (
open('README.txt').read()
......
......@@ -154,7 +154,7 @@ def main(args=None):
code & 0x80,
code & 0x7e)
# And pass it to the simulation.
this_interval = int(ts)/interval_step
this_interval = int(ts) // interval_step
if this_interval != last_interval:
if last_interval is not None:
interval_sim.report()
......
......@@ -298,8 +298,7 @@ def dumpbysize(bysize, how, how2):
print()
print("Unique sizes %s: %s" % (how, addcommas(len(bysize))))
print("%10s %6s %6s" % ("size", "objs", how2))
sizes = bysize.keys()
sizes.sort()
sizes = sorted(bysize.keys())
for size in sizes:
loads = 0
for n in six.itervalues(bysize[size]):
......@@ -348,15 +347,14 @@ def histogram(d):
bins = {}
for v in six.itervalues(d):
bins[v] = bins.get(v, 0) + 1
L = bins.items()
L.sort()
L = sorted(bins.items())
return L
def U64(s):
return struct.unpack(">Q", s)[0]
def oid_repr(oid):
if isinstance(oid, str) and len(oid) == 8:
if isinstance(oid, six.binary_type) and len(oid) == 8:
return '%16x' % U64(oid)
else:
return repr(oid)
......
......@@ -424,7 +424,7 @@ def thread_safe():
>>> for i in range(100):
... cache.store(ZODB.utils.p64(i), ZODB.utils.p64(1), None, b'0')
>>> import random, sys, threading
>>> import random2 as random, sys, threading
>>> random = random.Random(0)
>>> stop = False
>>> read_failure = None
......@@ -512,7 +512,7 @@ Check to make sure the cache analysis scripts work.
>>> time.time = lambda : now
>>> os.environ["ZEO_CACHE_TRACE"] = 'yes'
>>> import random
>>> import random2 as random
>>> random = random.Random(42)
>>> history = []
>>> serial = 1
......
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