summaryrefslogtreecommitdiff
path: root/git/test/test_repo.py
diff options
context:
space:
mode:
authorKostis Anagnostopoulos <ankostis@gmail.com>2016-10-01 18:20:13 +0200
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-10-01 18:25:57 +0200
commit9a521681ff8614beb8e2c566cf3c475baca22169 (patch)
tree77365cb808a255eb53889725bfce775b5090330e /git/test/test_repo.py
parentbdf1e68f6bec679edc3feb455596e18c387879c4 (diff)
downloadgitpython-9a521681ff8614beb8e2c566cf3c475baca22169.tar.gz
io, #519: ALL open() --> with open()
+ Some cases had restructuring of code.
Diffstat (limited to 'git/test/test_repo.py')
-rw-r--r--git/test/test_repo.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index a37c9be9..349d955e 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -781,14 +781,16 @@ class TestRepo(TestBase):
real_path_abs = os.path.abspath(join_path_native(rwrepo.working_tree_dir, '.real'))
os.rename(rwrepo.git_dir, real_path_abs)
git_file_path = join_path_native(rwrepo.working_tree_dir, '.git')
- open(git_file_path, 'wb').write(fixture('git_file'))
+ with open(git_file_path, 'wb') as fp:
+ fp.write(fixture('git_file'))
# Create a repo and make sure it's pointing to the relocated .git directory.
git_file_repo = Repo(rwrepo.working_tree_dir)
self.assertEqual(os.path.abspath(git_file_repo.git_dir), real_path_abs)
# Test using an absolute gitdir path in the .git file.
- open(git_file_path, 'wb').write(('gitdir: %s\n' % real_path_abs).encode('ascii'))
+ with open(git_file_path, 'wb') as fp:
+ fp.write(('gitdir: %s\n' % real_path_abs).encode('ascii'))
git_file_repo = Repo(rwrepo.working_tree_dir)
self.assertEqual(os.path.abspath(git_file_repo.git_dir), real_path_abs)