diff options
author | Guido Günther <agx@sigxcpu.org> | 2013-08-28 19:30:12 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-08-28 19:30:12 +0200 |
commit | c9d3d93d28f2a1f839770672f5846115d8d0e3c3 (patch) | |
tree | 2b0415593a8ad00a6110134dbdbaee7046481c01 /tests | |
parent | 8f073ebccd35f331981c8e2a396c0999de25a0b2 (diff) | |
download | git-buildpackage-c9d3d93d28f2a1f839770672f5846115d8d0e3c3.tar.gz git-buildpackage-c9d3d93d28f2a1f839770672f5846115d8d0e3c3.tar.bz2 git-buildpackage-c9d3d93d28f2a1f839770672f5846115d8d0e3c3.zip |
Use open() instead of file()
since the later doesn't exist in python3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/07_test_fastimport.py | 2 | ||||
-rw-r--r-- | tests/09_test_write_tree.py | 2 | ||||
-rw-r--r-- | tests/11_test_dch_main.py | 2 | ||||
-rw-r--r-- | tests/15_test_DebianSource.py | 2 | ||||
-rw-r--r-- | tests/16_test_supercommand.py | 2 | ||||
-rw-r--r-- | tests/test_Config.py | 6 | ||||
-rw-r--r-- | tests/test_GitVfs.py | 2 | ||||
-rw-r--r-- | tests/testutils.py | 2 |
8 files changed, 10 insertions, 10 deletions
diff --git a/tests/07_test_fastimport.py b/tests/07_test_fastimport.py index 42824f94..0a14d38d 100644 --- a/tests/07_test_fastimport.py +++ b/tests/07_test_fastimport.py @@ -38,7 +38,7 @@ def test_add_file(): fastimport.deleteall() testfile = os.path.join(repo.path, '.git', 'description') fastimport.add_file('./testfile', - file(testfile), + open(testfile), os.path.getsize(testfile)) def test_add_symlink(): diff --git a/tests/09_test_write_tree.py b/tests/09_test_write_tree.py index 3534f77e..7147da50 100644 --- a/tests/09_test_write_tree.py +++ b/tests/09_test_write_tree.py @@ -19,7 +19,7 @@ class TestWriteTree(testutils.DebianGitTestRepo): paths = [] for i in range(4): path = os.path.join(self.repo.path, 'testfile%d' % i) - with file(path, 'w') as f: + with open(path, 'w') as f: print >>f, "testdata %d" % i paths.append(path) return paths diff --git a/tests/11_test_dch_main.py b/tests/11_test_dch_main.py index 1849a3df..2ce99063 100644 --- a/tests/11_test_dch_main.py +++ b/tests/11_test_dch_main.py @@ -79,7 +79,7 @@ class TestScriptDch(DebianGitTestRepo): options.extend(dch_options) ret = dch.main(options) self.assertEqual(ret, 0) - return file("debian/changelog").readlines() + return open("debian/changelog").readlines() def test_dch_main_new_upstream_version(self): diff --git a/tests/15_test_DebianSource.py b/tests/15_test_DebianSource.py index 4896b319..feca6256 100644 --- a/tests/15_test_DebianSource.py +++ b/tests/15_test_DebianSource.py @@ -52,7 +52,7 @@ class TestDebianSource(testutils.DebianGitTestRepo): self.assertRaises(DebianSourceError, source.is_native) - with file('debian/changelog', 'w') as f: + with open('debian/changelog', 'w') as f: f.write("""git-buildpackage (0.2.3) git-buildpackage; urgency=low * git doesn't like '~' in tag names so replace this with a dot when tagging diff --git a/tests/16_test_supercommand.py b/tests/16_test_supercommand.py index 884437bc..f72bb562 100644 --- a/tests/16_test_supercommand.py +++ b/tests/16_test_supercommand.py @@ -37,7 +37,7 @@ class TestSuperCommand(unittest.TestCase): def test_invalid_command(self): """Test if we fail correctly with an invalid command""" old_stderr = sys.stderr - with file('/dev/null', 'w') as sys.stderr: + with open('/dev/null', 'w') as sys.stderr: self.assertEqual(gbp.scripts.supercommand.supercommand( ['argv0', 'asdf']), 2) self.assertEqual(gbp.scripts.supercommand.supercommand( diff --git a/tests/test_Config.py b/tests/test_Config.py index 995d6196..9a68f8cc 100644 --- a/tests/test_Config.py +++ b/tests/test_Config.py @@ -71,7 +71,7 @@ def test_parser_fallback(): >>> tmpdir = str(context.new_tmpdir('foo')) >>> confname = os.path.join(tmpdir, 'gbp.conf') >>> parser.config_files = [confname] - >>> f = file(confname, 'w') + >>> f = open(confname, 'w') >>> f.write('[foo]\\nthere = is\\n[git-foo]\\nno = truth\\n') >>> f.close() >>> parser._parse_config_files() @@ -90,13 +90,13 @@ def test_filter(): >>> tmpdir = str(context.new_tmpdir('bar')) >>> confname = os.path.join(tmpdir, 'gbp.conf') >>> parser.config_files = [confname] - >>> f = file(confname, 'w') + >>> f = open(confname, 'w') >>> f.write('[bar]\\nfilter = asdf\\n') >>> f.close() >>> parser._parse_config_files() >>> parser.config['filter'] ['asdf'] - >>> f = file(confname, 'w') + >>> f = open(confname, 'w') >>> f.write("[bar]\\nfilter = ['this', 'is', 'a', 'list']\\n") >>> f.close() >>> parser._parse_config_files() diff --git a/tests/test_GitVfs.py b/tests/test_GitVfs.py index dda156d5..7004db1f 100644 --- a/tests/test_GitVfs.py +++ b/tests/test_GitVfs.py @@ -26,7 +26,7 @@ def test_read(): >>> import os, gbp.git.vfs >>> repo_dir = context.new_tmpdir(__name__) >>> repo = gbp.git.GitRepository.create(str(repo_dir)) - >>> f = file(os.path.join(repo.path, 'foo.txt'), 'w') + >>> f = open(os.path.join(repo.path, 'foo.txt'), 'w') >>> content = 'al pha\\na\\nb\\nc' >>> f.write('al pha\\na\\nb\\nc') >>> f.close() diff --git a/tests/testutils.py b/tests/testutils.py index 617a7abc..c8631955 100644 --- a/tests/testutils.py +++ b/tests/testutils.py @@ -38,7 +38,7 @@ class DebianGitTestRepo(unittest.TestCase): if not os.path.exists(d): os.makedirs(d) - with file(path, 'w+') as f: + with open(path, 'w+') as f: content == None or f.write(content) self.repo.add_files(name, force=True) self.repo.commit_files(path, msg or "added %s" % name) |