summaryrefslogtreecommitdiff
path: root/tests/test-concurrency.py
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2018-01-17 14:42:20 +0000
committerAtomic Bot <atomic-devel@projectatomic.io>2018-02-22 19:24:47 +0000
commit02dc5e2dd47d1be0eb73d2f7e5b588f04c572390 (patch)
tree3a45960dcafa10ab7e4316d5740389b0f1c3645f /tests/test-concurrency.py
parent9933de232304f47e2be09c72906cc5183d9bbfda (diff)
downloadostree-02dc5e2dd47d1be0eb73d2f7e5b588f04c572390.tar.gz
test-concurrency: Replace range with xrange
range in Python 3 does what xrange did in Python 2. This still works in Python 2, it just uses a bit more memory. 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.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test-concurrency.py b/tests/test-concurrency.py
index 6fade24f..f16f696b 100755
--- a/tests/test-concurrency.py
+++ b/tests/test-concurrency.py
@@ -34,7 +34,7 @@ def fatal(msg):
def mktree(dname, serial=0):
print('Creating tree', dname, file=sys.stderr)
os.mkdir(dname, 0o755)
- for v in xrange(20):
+ for v in range(20):
with open('{}/{}'.format(dname, v), 'w') as f:
f.write('{} {} {}\n'.format(dname, serial, v))
@@ -79,12 +79,12 @@ def run(n_committers, n_pruners):
print('n_committers', n_committers, 'n_pruners', n_pruners, file=sys.stderr)
n_trees = n_committers / 2
- for v in xrange(n_trees):
+ for v in range(n_trees):
mktree('tree{}'.format(v))
- for v in xrange(n_committers):
+ for v in range(n_committers):
committers.add(commit(v / 2))
- for v in xrange(n_pruners):
+ for v in range(n_pruners):
pruners.add(prune())
failed = False
@@ -97,7 +97,7 @@ def run(n_committers, n_pruners):
if failed:
fatal('A child process exited abnormally')
- for v in xrange(n_trees):
+ for v in range(n_trees):
shutil.rmtree('tree{}'.format(v))
# No concurrent pruning