commit: d161e4fb9e41cdc841adb40b86ab6cbb5b01a0a2 Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org> AuthorDate: Thu Jun 12 21:39:26 2014 +0000 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> CommitDate: Sun Jun 15 00:36:41 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=d161e4fb
external.py: Adds py3 compatibility to tests Adds py3 urllib imports, print function updates, and implicit utf-8 decoding of test strings. --- layman/tests/external.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/layman/tests/external.py b/layman/tests/external.py index 82825e2..5882270 100755 --- a/layman/tests/external.py +++ b/layman/tests/external.py @@ -15,11 +15,15 @@ # '''Runs external (non-doctest) test cases.''' -import unittest import os -import tempfile import shutil -import urllib +import tempfile +import unittest +#Py3 +try: + import urllib.request as urllib +except ImportError: + import urllib from layman.dbbase import DbBase from layman.output import Message from layman.config import BareConfig @@ -35,8 +39,8 @@ class Unicode(unittest.TestCase): o = DbBase(config, [filename]) for verbose in (True, False): for t in o.list(verbose=verbose): - print t[0] - print + print(t[0].decode('utf-8')) + print() def test_184449(self): self._overlays_bug(184449)