Commit 4fdbb165 authored by Dionysis Zindros's avatar Dionysis Zindros
Browse files

Windows port: Unit tests now avoid /dev/urandom.

Instead of using /dev/urandom which is specific to UNIX systems, switch to the
Python os.urandom() which is a cross-system solution and also works on Windows
systems. This allows for running the unit tests on Windows systems as well.
parent c4993bcf
......@@ -2317,15 +2317,12 @@ class testPithos(unittest.TestCase):
def create_large_file(self, size, name):
"""Create a large file at fs"""
self.fname = name
import random
random.seed(self.now)
rf = open('/dev/urandom', 'r')
f = open(self.fname, 'w')
sys.stdout.write(
' create random file %s of size %s ' % (name, size))
for hobyte_id in range(size / 8):
#sss = 'hobt%s' % random.randint(1000, 9999)
f.write(rf.read(8))
random_bytes = os.urandom(8)
f.write(random_bytes)
if 0 == (hobyte_id * 800) % size:
f.write('\n')
f.flush()
......@@ -2337,7 +2334,6 @@ class testPithos(unittest.TestCase):
sys.stdout.flush()
print('\b\b\b100%')
f.flush()
rf.close()
f.close()
""""""
......
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