diff options
author | Jeremy Heiner <scalaprotractor@gmail.com> | 2013-10-12 18:44:35 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-10-14 05:01:15 +0200 |
commit | e9c7c3b90d1f266aebc98a36b1d32a61f7113505 (patch) | |
tree | 0662346429d659845c6856a6978a5b38110735cb /test | |
parent | 95b0a868f255f2766ae03733882f30c8c7f3b7ca (diff) | |
download | pacman-e9c7c3b90d1f266aebc98a36b1d32a61f7113505.tar.gz pacman-e9c7c3b90d1f266aebc98a36b1d32a61f7113505.tar.xz |
Use Python's "range" instead of deprecated "xrange".
Reported by 2to3. Python 3 throws out the old range, renames the old
xrange to be the new range, leaving no xrange. A shim could be used,
but using the less efficient version does not have a noticeable impact
on the run time. This observed (lack of an) effect is as described in
the Python 2 docs for xrange. The largest range created is only 1000
elements big, and the memory cost of those ranges is negligible when
compared to that of all the pmpkg instances created.
Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/pacman/tests/smoke001.py | 4 | ||||
-rw-r--r-- | test/pacman/tests/smoke003.py | 4 | ||||
-rw-r--r-- | test/pacman/tests/xfercommand001.py | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/test/pacman/tests/smoke001.py b/test/pacman/tests/smoke001.py index 16576b75..ccc9db48 100644 --- a/test/pacman/tests/smoke001.py +++ b/test/pacman/tests/smoke001.py @@ -4,7 +4,7 @@ p = pmpkg("pkg1000") self.addpkg2db("local", p) -for i in xrange(1000): +for i in range(1000): p = pmpkg("pkg%03d" % i) p.depends = ["pkg%03d" % (i+1)] p.files = ["usr/share/pkg%03d" % i] @@ -14,7 +14,7 @@ pkglist = [p.filename() for p in self.localpkgs] self.args = "-U %s" % " ".join(pkglist) self.addrule("PACMAN_RETCODE=0") -#for i in xrange(1000): +#for i in range(1000): # self.addrule("PKG_EXIST=pkg%03d" %i) # picked 3 random packages to test for, since the loop is too much to handle self.addrule("PKG_EXIST=pkg050") diff --git a/test/pacman/tests/smoke003.py b/test/pacman/tests/smoke003.py index c2460fbf..74083c7b 100644 --- a/test/pacman/tests/smoke003.py +++ b/test/pacman/tests/smoke003.py @@ -1,11 +1,11 @@ self.description = "Remove a thousand packages in a single transaction" -for i in xrange(1000): +for i in range(1000): p = pmpkg("pkg%03dname" % i) p.files = ["usr/share/pkg%03d/file" % i] self.addpkg2db("local", p) -pkglist = ["pkg%03dname" % i for i in xrange(100, 1000)] +pkglist = ["pkg%03dname" % i for i in range(100, 1000)] self.args = "-R %s" % " ".join(pkglist) self.addrule("PACMAN_RETCODE=0") diff --git a/test/pacman/tests/xfercommand001.py b/test/pacman/tests/xfercommand001.py index a645cf7f..0d244dc6 100644 --- a/test/pacman/tests/xfercommand001.py +++ b/test/pacman/tests/xfercommand001.py @@ -7,7 +7,7 @@ self.option['XferCommand'] = ['/usr/bin/curl %u > %o'] numpkgs = 10 pkgnames = [] -for i in xrange(numpkgs): +for i in range(numpkgs): name = "pkg_%s" % i pkgnames.append(name) p = pmpkg(name) |