summaryrefslogtreecommitdiff
path: root/tests/test-concurrency.py
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2018-01-17 15:03:59 +0000
committerAtomic Bot <atomic-devel@projectatomic.io>2018-02-22 19:24:47 +0000
commit98b597b465a556f3ad5b16478d7edee3037fbd4d (patch)
tree007ff9846ba3be52b80250e962bf6e4a8a21bee6 /tests/test-concurrency.py
parent02dc5e2dd47d1be0eb73d2f7e5b588f04c572390 (diff)
downloadostree-98b597b465a556f3ad5b16478d7edee3037fbd4d.tar.gz
test-concurrency: Explicitly use floor division
Python 3 is pickier about this. Python 2.7 has Python 3-compatible semantics for division when the division feature is imported from the future. Signed-off-by: Simon McVittie <smcv@debian.org> Closes: #1457 Approved by: cgwalters
Diffstat (limited to 'tests/test-concurrency.py')
-rwxr-xr-xtests/test-concurrency.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test-concurrency.py b/tests/test-concurrency.py
index f16f696b..3a0ce103 100755
--- a/tests/test-concurrency.py
+++ b/tests/test-concurrency.py
@@ -17,6 +17,7 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
+from __future__ import division
from __future__ import print_function
import os
import sys
@@ -78,12 +79,12 @@ def run(n_committers, n_pruners):
pruners = set()
print('n_committers', n_committers, 'n_pruners', n_pruners, file=sys.stderr)
- n_trees = n_committers / 2
+ n_trees = n_committers // 2
for v in range(n_trees):
mktree('tree{}'.format(v))
for v in range(n_committers):
- committers.add(commit(v / 2))
+ committers.add(commit(v // 2))
for v in range(n_pruners):
pruners.add(prune())
@@ -101,8 +102,8 @@ def run(n_committers, n_pruners):
shutil.rmtree('tree{}'.format(v))
# No concurrent pruning
-run(cpu_count()/2 + 2, 0)
+run(cpu_count() // 2 + 2, 0)
print("ok no concurrent prunes")
-run(cpu_count()/2 + 4, 3)
+run(cpu_count() // 2 + 4, 3)
print("ok concurrent prunes")