Commit c5fe99f8 authored by Luke Macken's avatar Luke Macken

Fix our random.SystemRandom usage

parent 8778866c
...@@ -56,8 +56,7 @@ class TestCodeInjection(unittest.TestCase): ...@@ -56,8 +56,7 @@ class TestCodeInjection(unittest.TestCase):
(fd, filename) = tempfile.mkstemp() (fd, filename) = tempfile.mkstemp()
tmp = os.fdopen(fd, 'w') tmp = os.fdopen(fd, 'w')
script = textwrap.dedent(""" script = textwrap.dedent("""
import time, threading import time, threading, random
from random import SystemRandom as random
running = True running = True
def cpu_bound(): def cpu_bound():
i = 2 i = 2
...@@ -68,8 +67,9 @@ class TestCodeInjection(unittest.TestCase): ...@@ -68,8 +67,9 @@ class TestCodeInjection(unittest.TestCase):
y += fib(i) y += fib(i)
i += 1 i += 1
def io_bound(): def io_bound():
rand = SystemRandom()
while running: while running:
random.random() rand.random()
""") """)
# CPU-bound threads # CPU-bound threads
for t in range(cpu_threads): for t in range(cpu_threads):
......
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