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
This commit is contained in:
Simon McVittie 2018-01-17 15:03:59 +00:00 committed by Atomic Bot
parent 02dc5e2dd4
commit 98b597b465

View File

@ -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")