From 9a521681ff8614beb8e2c566cf3c475baca22169 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Sat, 1 Oct 2016 18:20:13 +0200 Subject: io, #519: ALL open() --> with open() + Some cases had restructuring of code. --- git/test/lib/helper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'git/test/lib/helper.py') 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 -- cgit v1.2.1