From: Ralph Bean Date: Mon, 16 Nov 2015 04:30:04 +0000 (-0500) Subject: More fixes to the tests. X-Git-Tag: upstream/0.10.0~20^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=468862fc2886d555452bd656b51b1f23c2e4a742;p=services%2Fcreaterepo_c.git More fixes to the tests. --- diff --git a/tests/python/tests/test_crfile.py b/tests/python/tests/test_crfile.py index e5adb72..2b0bc5b 100644 --- a/tests/python/tests/test_crfile.py +++ b/tests/python/tests/test_crfile.py @@ -77,7 +77,7 @@ class TestCaseCrFile(unittest.TestCase): f.close() import gzip - content = gzip.open(path).read() + content = gzip.open(path).read().decode('utf-8') self.assertEqual(content, "foobar") def test_crfile_bz2_compression(self): @@ -89,7 +89,7 @@ class TestCaseCrFile(unittest.TestCase): f.close() import bz2 - content = bz2.decompress(open(path).read()) + content = bz2.decompress(open(path, 'rb').read()).decode('utf-8') self.assertEqual(content, "foobar") def test_crfile_xz_compression(self): @@ -102,5 +102,5 @@ class TestCaseCrFile(unittest.TestCase): import subprocess p = subprocess.Popen(["unxz", "--stdout", path], stdout=subprocess.PIPE) - content = p.stdout.read() + content = p.stdout.read().decode('utf-8') self.assertEqual(content, "foobar") diff --git a/tests/python/tests/test_misc.py b/tests/python/tests/test_misc.py index b95cd9a..22388aa 100644 --- a/tests/python/tests/test_misc.py +++ b/tests/python/tests/test_misc.py @@ -77,5 +77,5 @@ class TestCaseMisc(unittest.TestCase): self.assertTrue(os.path.isfile(dest)) self.assertEqual(stat.checksum, FILE_TEXT_SHA256SUM) self.assertEqual(stat.checksum_type, cr.SHA256) - self.assertEqual(stat.size, 910L) + self.assertEqual(stat.size, 910) diff --git a/tests/python/tests/test_package.py b/tests/python/tests/test_package.py index 7bbbc03..bb2ea28 100644 --- a/tests/python/tests/test_package.py +++ b/tests/python/tests/test_package.py @@ -118,11 +118,11 @@ class TestCasePackage(unittest.TestCase): ('', '/usr/share/doc/Archer-3.4.5/', 'README') ]) self.assertEqual(pkg.changelogs, [ - ('Tomas Mlcoch - 1.1.1-1', 1334664000L, + ('Tomas Mlcoch - 1.1.1-1', 1334664000, '- First changelog.'), - ('Tomas Mlcoch - 2.2.2-2', 1334750400L, + ('Tomas Mlcoch - 2.2.2-2', 1334750400, '- That was totally ninja!'), - ('Tomas Mlcoch - 3.3.3-3', 1365422400L, + ('Tomas Mlcoch - 3.3.3-3', 1365422400, '- 3. changelog.') ]) @@ -202,8 +202,8 @@ class TestCasePackage(unittest.TestCase): self.assertEqual(pkg.supplements, [('foo_sup', 'GE', '0', '1.1.0', None, False)]) pkg.files = [(None, '/foo/', 'bar')] self.assertEqual(pkg.files, [(None, '/foo/', 'bar')]) - pkg.changelogs = [('me', 123456L, 'first commit')] - self.assertEqual(pkg.changelogs, [('me', 123456L, 'first commit')]) + pkg.changelogs = [('me', 123456, 'first commit')] + self.assertEqual(pkg.changelogs, [('me', 123456, 'first commit')]) self.assertEqual(pkg.nvra(), "bar-11-33.quantum") self.assertEqual(pkg.nevra(), "bar-22:11-33.quantum") diff --git a/tests/python/tests/test_version.py b/tests/python/tests/test_version.py index 52aa6e3..2a944c2 100644 --- a/tests/python/tests/test_version.py +++ b/tests/python/tests/test_version.py @@ -1,7 +1,7 @@ import unittest import createrepo_c as cr -import fixtures +from . import fixtures class TestCaseVersion(unittest.TestCase): def test_version(self): diff --git a/tests/python/tests/test_xml_file.py b/tests/python/tests/test_xml_file.py index 2244d1e..5e824c8 100644 --- a/tests/python/tests/test_xml_file.py +++ b/tests/python/tests/test_xml_file.py @@ -100,7 +100,7 @@ class TestCaseXmlFile(unittest.TestCase): f.close() import gzip - content = gzip.open(path).read() + content = gzip.open(path).read().decode('utf-8') self.assertEqual(content, """ @@ -114,7 +114,7 @@ class TestCaseXmlFile(unittest.TestCase): f.close() import bz2 - content = bz2.decompress(open(path).read()) + content = bz2.decompress(open(path, 'rb').read()).decode('utf-8') self.assertEqual(content, """ @@ -129,7 +129,7 @@ class TestCaseXmlFile(unittest.TestCase): import subprocess p = subprocess.Popen(["unxz", "--stdout", path], stdout=subprocess.PIPE) - content = p.stdout.read() + content = p.stdout.read().decode('utf-8') self.assertEqual(content, """