summaryrefslogtreecommitdiff
path: root/git/test/lib/helper.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/lib/helper.py
parentbdf1e68f6bec679edc3feb455596e18c387879c4 (diff)
downloadgitpython-9a521681ff8614beb8e2c566cf3c475baca22169.tar.gz
io, #519: ALL open() --> with open()
+ Some cases had restructuring of code.
Diffstat (limited to 'git/test/lib/helper.py')
-rw-r--r--git/test/lib/helper.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py
index 90d2b1e9..a85ac2fd 100644
--- a/git/test/lib/helper.py
+++ b/git/test/lib/helper.py
@@ -39,7 +39,8 @@ def fixture_path(name):
def fixture(name):
- return open(fixture_path(name), 'rb').read()
+ with open(fixture_path(name), 'rb') as fd:
+ return fd.read()
def absolute_project_path():
@@ -373,7 +374,6 @@ class TestBase(TestCase):
"""
repo = repo or self.rorepo
abs_path = os.path.join(repo.working_tree_dir, rela_path)
- fp = open(abs_path, "w")
- fp.write(data)
- fp.close()
+ with open(abs_path, "w") as fp:
+ fp.write(data)
return abs_path