Patchwork [2,of,4,py3] tests: make test-manifest finish importing in Python 3

login
register
mail settings
Submitter Augie Fackler
Date May 29, 2017, 1:43 a.m.
Message ID <221e447c9410325c4051.1496022183@imladris.local>
Download mbox | patch
Permalink /patch/21027/
State Accepted
Headers show

Comments

Augie Fackler - May 29, 2017, 1:43 a.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1496009316 14400
#      Sun May 28 18:08:36 2017 -0400
# Node ID 221e447c9410325c4051e61e762e2afd871a9b0f
# Parent  a6e3817ee02bbcc2480a233ceb161586348b211a
tests: make test-manifest finish importing in Python 3

The test is still broken, but now it executes.

Patch

diff --git a/tests/test-manifest.py b/tests/test-manifest.py
--- a/tests/test-manifest.py
+++ b/tests/test-manifest.py
@@ -92,11 +92,15 @@  A_DEEPER_MANIFEST = (
 
 HUGE_MANIFEST_ENTRIES = 200001
 
+izip = getattr(itertools, 'izip', zip)
+if 'xrange' not in globals():
+    xrange = range
+
 A_HUGE_MANIFEST = ''.join(sorted(
     'file%d\0%s%s\n' % (i, h, f) for i, h, f in
-    itertools.izip(xrange(200001),
-                   itertools.cycle((HASH_1, HASH_2)),
-                   itertools.cycle(('', 'x', 'l')))))
+    izip(xrange(200001),
+         itertools.cycle((HASH_1, HASH_2)),
+         itertools.cycle(('', 'x', 'l')))))
 
 class basemanifesttests(object):
     def parsemanifest(self, text):