diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/02_test_upstream_source_tar_unpack.py | 8 | ||||
-rw-r--r-- | tests/03_test_dch_guess_version.py | 2 | ||||
-rw-r--r-- | tests/09_test_write_tree.py | 2 | ||||
-rw-r--r-- | tests/14_test_gbp_import_dscs.py | 2 | ||||
-rw-r--r-- | tests/15_test_DebianSource.py | 2 | ||||
-rw-r--r-- | tests/17_test_dch_guess_documented_commit.py | 2 | ||||
-rw-r--r-- | tests/19_test_gbp_scripts_config.py | 2 | ||||
-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 | ||||
-rw-r--r-- | tests/test_GitRepository.py | 4 | ||||
-rw-r--r-- | tests/test_import_orig.py | 6 | ||||
-rw-r--r-- | tests/test_rpm.py | 2 |
14 files changed, 25 insertions, 25 deletions
diff --git a/tests/02_test_upstream_source_tar_unpack.py b/tests/02_test_upstream_source_tar_unpack.py index e6147abd..4d44f059 100644 --- a/tests/02_test_upstream_source_tar_unpack.py +++ b/tests/02_test_upstream_source_tar_unpack.py @@ -52,7 +52,7 @@ class TestUnpack(unittest.TestCase): context.teardown() def test_upstream_source_type(self): - for (comp, archive) in self.archives.iteritems(): + for (comp, archive) in self.archives.items(): source = gbp.pkg.UpstreamSource(archive[0]) assert source.is_orig() == True assert source.is_dir() == False @@ -63,13 +63,13 @@ class TestUnpack(unittest.TestCase): assert type(source.unpacked) == str def test_upstream_source_unpack(self): - for (comp, archive) in self.archives.iteritems(): + for (comp, archive) in self.archives.items(): source = gbp.pkg.UpstreamSource(archive[0]) source.unpack(".") self._check_files(archive[1], comp) def test_upstream_source_unpack_no_filter(self): - for (comp, archive) in self.archives.iteritems(): + for (comp, archive) in self.archives.items(): source = gbp.pkg.UpstreamSource(archive[0]) source.unpack(".", []) self._check_files(archive[1], comp) @@ -77,7 +77,7 @@ class TestUnpack(unittest.TestCase): def test_upstream_source_unpack_filtered(self): exclude = "README" - for (comp, archive) in self.archives.iteritems(): + for (comp, archive) in self.archives.items(): source = gbp.pkg.UpstreamSource(archive[0]) source.unpack(".", [exclude]) archive[1].remove(exclude) diff --git a/tests/03_test_dch_guess_version.py b/tests/03_test_dch_guess_version.py index 6109bfb3..5dca3b71 100644 --- a/tests/03_test_dch_guess_version.py +++ b/tests/03_test_dch_guess_version.py @@ -4,7 +4,7 @@ from . import context -import testutils +from . import testutils from gbp.scripts import dch diff --git a/tests/09_test_write_tree.py b/tests/09_test_write_tree.py index 55a1da60..9ae636e3 100644 --- a/tests/09_test_write_tree.py +++ b/tests/09_test_write_tree.py @@ -20,7 +20,7 @@ class TestWriteTree(testutils.DebianGitTestRepo): for i in range(4): path = os.path.join(self.repo.path, 'testfile%d' % i) with open(path, 'w') as f: - print >>f, "testdata %d" % i + print("testdata %d" % i, file=f) paths.append(path) return paths diff --git a/tests/14_test_gbp_import_dscs.py b/tests/14_test_gbp_import_dscs.py index ba3d5f79..2fdc2e6e 100644 --- a/tests/14_test_gbp_import_dscs.py +++ b/tests/14_test_gbp_import_dscs.py @@ -17,7 +17,7 @@ from . import context -import testutils +from . import testutils import gbp.log import gbp.scripts.import_dscs as import_dscs diff --git a/tests/15_test_DebianSource.py b/tests/15_test_DebianSource.py index feca6256..a4ea5562 100644 --- a/tests/15_test_DebianSource.py +++ b/tests/15_test_DebianSource.py @@ -18,7 +18,7 @@ from . import context import os -import testutils +from . import testutils from gbp.deb.source import DebianSource, DebianSourceError from gbp.deb.format import DebianSourceFormat from gbp.git.vfs import GitVfs diff --git a/tests/17_test_dch_guess_documented_commit.py b/tests/17_test_dch_guess_documented_commit.py index 89eba2d3..78adca8a 100644 --- a/tests/17_test_dch_guess_documented_commit.py +++ b/tests/17_test_dch_guess_documented_commit.py @@ -4,7 +4,7 @@ from . import context -import testutils +from . import testutils from gbp.scripts import dch diff --git a/tests/19_test_gbp_scripts_config.py b/tests/19_test_gbp_scripts_config.py index c984329a..8bb21053 100644 --- a/tests/19_test_gbp_scripts_config.py +++ b/tests/19_test_gbp_scripts_config.py @@ -78,7 +78,7 @@ class TestGbpConfigCommand(unittest.TestCase): 'pull' ]: printstub = self.AllValuesPrintStub(cmd) ret = gbp.scripts.config.print_cmd_all_values(cmd, printstub) - self.assertTrue('%s.color' % cmd in printstub.result.keys()) + self.assertTrue('%s.color' % cmd in list(printstub.result.keys())) self.assertEqual(ret, 0) def test_invalid_cms(self): 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) diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py index e44b60b7..f8cfafec 100644 --- a/tests/test_GitRepository.py +++ b/tests/test_GitRepository.py @@ -17,9 +17,9 @@ import gbp.log gbp.log.setup(color=False, verbose=True) -repo_dir, bare_dir, clone_dir, mirror_clone_dir = map( +repo_dir, bare_dir, clone_dir, mirror_clone_dir = list(map( lambda x, tmpdir=context.new_tmpdir(__name__): tmpdir.join(x), - ['repo', 'bare', 'clone', 'mirror_clone']) + ['repo', 'bare', 'clone', 'mirror_clone'])) def test_create(): """ diff --git a/tests/test_import_orig.py b/tests/test_import_orig.py index aa39e380..72dc67f9 100644 --- a/tests/test_import_orig.py +++ b/tests/test_import_orig.py @@ -52,15 +52,15 @@ class TestFindSource(TestImportOrigBase): def test_failure(self): """Test failure modes""" - with self.assertRaisesRegexp(GbpError, + with self.assertRaisesRegex(GbpError, "More than one archive specified"): find_source(False, ['too', 'much']) - with self.assertRaisesRegexp(GbpError, + with self.assertRaisesRegex(GbpError, "No archive to import specified"): find_source(False, []) - with self.assertRaisesRegexp(GbpError, + with self.assertRaisesRegex(GbpError, "you can't pass both --uscan and a filename"): find_source(True, ['tarball']) diff --git a/tests/test_rpm.py b/tests/test_rpm.py index f059f556..3b25f8c6 100644 --- a/tests/test_rpm.py +++ b/tests/test_rpm.py @@ -319,7 +319,7 @@ class TestSpecFile(object): spec = SpecFileTester(spec_filepath) # Check all the tags - for name, val in spec.protected('_tags').iteritems(): + for name, val in spec.protected('_tags').items(): rval = None if name in ('version', 'release', 'epoch'): rval = '0' |