changeset 41254:2888d12b80a6

tests: fix up uses of xrange in remotefilelog tests for py3 Differential Revision: https://phab.mercurial-scm.org/D5604
author Augie Fackler <augie@google.com>
date Wed, 16 Jan 2019 10:59:32 -0500
parents 29996f6c2687
children 60b3edccf2f7
files tests/test-remotefilelog-cacheprocess.t tests/test-remotefilelog-datapack.py
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-remotefilelog-cacheprocess.t	Wed Jan 16 10:59:09 2019 -0500
+++ b/tests/test-remotefilelog-cacheprocess.t	Wed Jan 16 10:59:32 2019 -0500
@@ -18,6 +18,8 @@
   > import os
   > import shutil
   > import sys
+  > if sys.version_info[0] > 2:
+  >     xrange = range
   > f = open('$TESTTMP/cachelog.log', 'w')
   > srccache = os.path.join('$TESTTMP', 'oldhgcache')
   > def log(message):
--- a/tests/test-remotefilelog-datapack.py	Wed Jan 16 10:59:09 2019 -0500
+++ b/tests/test-remotefilelog-datapack.py	Wed Jan 16 10:59:32 2019 -0500
@@ -18,6 +18,7 @@
 sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')]
 from mercurial.node import nullid
 from mercurial import (
+    pycompat,
     ui as uimod,
 )
 from hgext.remotefilelog import (
@@ -245,7 +246,7 @@
         revisions = []
         blobs = {}
         total = basepack.SMALLFANOUTCUTOFF + 1
-        for i in xrange(total):
+        for i in pycompat.xrange(total):
             filename = "filename-%s" % i
             content = filename
             node = self.getHash(content)
@@ -328,7 +329,7 @@
         ]
         for packsize in packsizes:
             revisions = []
-            for i in xrange(packsize):
+            for i in pycompat.xrange(packsize):
                 filename = "filename-%s" % i
                 content = "content-%s" % i
                 node = self.getHash(content)