Discovered by running with 3.3.2. One test changed to avoid a lexical scoping change (fortunately the standard zip function is supported by all necessary versions and does what is needed). The other changes were to adjust to the more strict separation Python 3 puts between Unicode and byte data. Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com> Conflicts: test/pacman/util.py --- test/pacman/tests/epoch005.py | 2 +- test/pacman/util.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/pacman/tests/epoch005.py b/test/pacman/tests/epoch005.py index 6215170..3e2073a 100644 --- a/test/pacman/tests/epoch005.py +++ b/test/pacman/tests/epoch005.py @@ -8,7 +8,7 @@ "1234327518932650063289125782697892:1.0-1", ) -pkgvers = [(n, versions[n]) for n in range(len(versions))] +pkgvers = zip(range(len(versions)), versions) for k, v in pkgvers: sp = pmpkg("pkg_%d" % k, v) self.addpkg2db("sync", sp) diff --git a/test/pacman/util.py b/test/pacman/util.py index 86d0eb2..9283852 100644 --- a/test/pacman/util.py +++ b/test/pacman/util.py @@ -71,11 +71,14 @@ def itemsview(x): def new_StringIO(source): if sys.hexversion >= 0x03000000: import io - return io.StringIO(source) + return io.BytesIO(source.encode("utf8")) else: import StringIO return StringIO.StringIO(source) +def chars2bytes(source): + return source.encode("utf8") if sys.hexversion >= 0x03000000 else source + # # Methods to generate files @@ -181,7 +184,7 @@ def getmd5sum(filename): def mkmd5sum(data): checksum = hashlib.md5() - checksum.update("%s\n" % data) + checksum.update(chars2bytes("%s\n" % data)) return checksum.hexdigest() -- 1.8.4