Explorar o código

fix invalid param issue in benchmarks

fixes CID1431887
Thomas Waldmann %!s(int64=8) %!d(string=hai) anos
pai
achega
d949d6bc7c
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/borg/testsuite/benchmark.py

+ 3 - 1
src/borg/testsuite/benchmark.py

@@ -40,9 +40,11 @@ def testdata(request, tmpdir_factory):
         # do not use a binary zero (\0) to avoid sparse detection
         def data(size):
             return b'0' * size
-    if data_type == 'random':
+    elif data_type == 'random':
         def data(size):
             return os.urandom(size)
+    else:
+        raise ValueError("data_type must be 'random' or 'zeros'.")
     for i in range(count):
         with open(str(p.join(str(i))), "wb") as f:
             f.write(data(size))