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:
parent
02dc5e2dd4
commit
98b597b465
|
|
@ -17,6 +17,7 @@
|
||||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -78,12 +79,12 @@ def run(n_committers, n_pruners):
|
||||||
pruners = set()
|
pruners = set()
|
||||||
|
|
||||||
print('n_committers', n_committers, 'n_pruners', n_pruners, file=sys.stderr)
|
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):
|
for v in range(n_trees):
|
||||||
mktree('tree{}'.format(v))
|
mktree('tree{}'.format(v))
|
||||||
|
|
||||||
for v in range(n_committers):
|
for v in range(n_committers):
|
||||||
committers.add(commit(v / 2))
|
committers.add(commit(v // 2))
|
||||||
for v in range(n_pruners):
|
for v in range(n_pruners):
|
||||||
pruners.add(prune())
|
pruners.add(prune())
|
||||||
|
|
||||||
|
|
@ -101,8 +102,8 @@ def run(n_committers, n_pruners):
|
||||||
shutil.rmtree('tree{}'.format(v))
|
shutil.rmtree('tree{}'.format(v))
|
||||||
|
|
||||||
# No concurrent pruning
|
# No concurrent pruning
|
||||||
run(cpu_count()/2 + 2, 0)
|
run(cpu_count() // 2 + 2, 0)
|
||||||
print("ok no concurrent prunes")
|
print("ok no concurrent prunes")
|
||||||
|
|
||||||
run(cpu_count()/2 + 4, 3)
|
run(cpu_count() // 2 + 4, 3)
|
||||||
print("ok concurrent prunes")
|
print("ok concurrent prunes")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue