diff options
Diffstat (limited to 'tests/component')
-rw-r--r-- | tests/component/__init__.py | 2 | ||||
-rw-r--r-- | tests/component/rpm/__init__.py | 2 | ||||
-rw-r--r-- | tests/component/rpm/test_import_orig_rpm.py | 4 | ||||
-rw-r--r-- | tests/component/rpm/test_import_srpm.py | 10 |
4 files changed, 9 insertions, 9 deletions
diff --git a/tests/component/__init__.py b/tests/component/__init__.py index baabbbd3..66a5e2f4 100644 --- a/tests/component/__init__.py +++ b/tests/component/__init__.py @@ -24,7 +24,7 @@ import os import re import shutil import tempfile -from StringIO import StringIO +from io import StringIO from nose import SkipTest from nose.tools import eq_, ok_ # pylint: disable=E0611 diff --git a/tests/component/rpm/__init__.py b/tests/component/rpm/__init__.py index 26655756..008329b4 100644 --- a/tests/component/rpm/__init__.py +++ b/tests/component/rpm/__init__.py @@ -48,7 +48,7 @@ class RepoManifest(object): for prj_e in self._doc.getElementsByTagName('project'): branches = [] for br_e in prj_e.getElementsByTagName('branch'): - branches.append(dict(br_e.attributes.items())) + branches.append(dict(list(br_e.attributes.items()))) yield prj_e.getAttribute('name'), branches diff --git a/tests/component/rpm/test_import_orig_rpm.py b/tests/component/rpm/test_import_orig_rpm.py index ebf592a0..620697c4 100644 --- a/tests/component/rpm/test_import_orig_rpm.py +++ b/tests/component/rpm/test_import_orig_rpm.py @@ -24,7 +24,7 @@ import tarfile import tempfile from nose.plugins.skip import SkipTest from nose.tools import assert_raises, eq_ # pylint: disable=E0611 -from StringIO import StringIO +from io import StringIO from gbp.scripts.import_orig_rpm import main as import_orig_rpm from gbp.git import GitRepository @@ -112,7 +112,7 @@ class TestImportOrig(ImportOrigTestBase): def _create_dummy_spec(path, **kwargs): """Create a dummy spec file""" with open(path, 'w') as fobj: - print kwargs + print(kwargs) fobj.write(DUMMY_SPEC % kwargs) def test_invalid_args(self): diff --git a/tests/component/rpm/test_import_srpm.py b/tests/component/rpm/test_import_srpm.py index 6635400b..7dcfe223 100644 --- a/tests/component/rpm/test_import_srpm.py +++ b/tests/component/rpm/test_import_srpm.py @@ -18,7 +18,7 @@ import os import shutil -import urllib2 +import urllib.request, urllib.error, urllib.parse from nose.plugins.skip import SkipTest from nose.tools import assert_raises, eq_, ok_ # pylint: disable=E0611 from mock import Mock @@ -287,8 +287,8 @@ class TestDownloadImport(ComponentTestBase): 'master/gbp-test-1.0-1.src.rpm' # Mock to use local files instead of really downloading local_fn = os.path.join(DATA_DIR, os.path.basename(srpm)) - urllib2.urlopen = Mock() - urllib2.urlopen.return_value = open(local_fn, 'r') + urllib.request.urlopen = Mock() + urllib.request.urlopen.return_value = open(local_fn, 'r') eq_(mock_import(['--no-pristine-tar', '--download', srpm]), 0) # Check repository state @@ -299,8 +299,8 @@ class TestDownloadImport(ComponentTestBase): """Test graceful failure when trying download from nonexistent url""" srpm = 'http://url.does.not.exist.com/foo.src.rpm' # Do not connect to remote, mock failure - urllib2.urlopen = Mock() - urllib2.urlopen.side_effect = urllib2.HTTPError(srpm, 404, "Not found", + urllib.request.urlopen = Mock() + urllib.request.urlopen.side_effect = urllib.error.HTTPError(srpm, 404, "Not found", None, None) eq_(mock_import(['--download', srpm]), 1) |