summaryrefslogtreecommitdiff
path: root/git/test/test_git.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/test/test_git.py')
-rw-r--r--git/test/test_git.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 8a0242e6..94614cd1 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -93,10 +93,9 @@ class TestGit(TestBase):
def test_it_accepts_stdin(self):
filename = fixture_path("cat_file_blob")
- fh = open(filename, 'r')
- assert_equal("70c379b63ffa0795fdbfbc128e5a2818397b7ef8",
- self.git.hash_object(istream=fh, stdin=True))
- fh.close()
+ with open(filename, 'r') as fh:
+ assert_equal("70c379b63ffa0795fdbfbc128e5a2818397b7ef8",
+ self.git.hash_object(istream=fh, stdin=True))
@patch.object(Git, 'execute')
def test_it_ignores_false_kwargs(self, git):
@@ -200,10 +199,9 @@ class TestGit(TestBase):
self.assertEqual(self.git.environment(), {})
path = os.path.join(rw_dir, 'failing-script.sh')
- stream = open(path, 'wt')
- stream.write("#!/usr/bin/env sh\n" +
- "echo FOO\n")
- stream.close()
+ with open(path, 'wt') as stream:
+ stream.write("#!/usr/bin/env sh\n"
+ "echo FOO\n")
os.chmod(path, 0o777)
rw_repo = Repo.init(os.path.join(rw_dir, 'repo'))