Port to Python 3

This should make all tests pass on both Python 2 and Python 3.

Unittest2 is required on Py 2.6 and Py 3.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-09-05 10:01:21 +02:00
parent 3088df8e60
commit ed22e07ef9
50 changed files with 203 additions and 208 deletions

View file

@ -9,6 +9,7 @@ except ImportError:
import os
import tempfile
import shutil
import six
import sys
import logging
@ -27,6 +28,11 @@ try:
except ImportError:
HAS_DNF = False
if six.PY2:
HAS_YUM = True
else:
HAS_YUM = False
def convert_pkg_map(data):
"""
@ -1627,6 +1633,7 @@ class DepsolvingBase(object):
])
@unittest.skipUnless(HAS_YUM, 'YUM only available on Python 2')
class PungiYumDepsolvingTestCase(DepsolvingBase, unittest.TestCase):
def setUp(self):
@ -1789,6 +1796,3 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase):
self.assertFlags("dummy-krb5-devel-1.10-5.x86_64", [PkgFlag.lookaside])
self.assertFlags("dummy-krb5-1.10-5.src", [PkgFlag.lookaside])
self.assertFlags("dummy-krb5-debuginfo-1.10-5.x86_64", [PkgFlag.lookaside])
if __name__ == "__main__":
unittest.main()