diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2016-07-30 16:43:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-30 16:43:48 +0200 |
| commit | 58cfb7e21253287240f24290e69c00e5e119c400 (patch) | |
| tree | aee6ea858fd1e828908b96735239ea24693efa8a /gitdb/test/db | |
| parent | 40ec1fa3a2cfad1ace13f801a35364e9ec050d7f (diff) | |
| parent | f957c812ac3221773058ba2fa8cd38017537da8a (diff) | |
| download | gitdb-58cfb7e21253287240f24290e69c00e5e119c400.tar.gz | |
Merge pull request #28 from scop/with
Handle more file open/close with "with"
Diffstat (limited to 'gitdb/test/db')
| -rw-r--r-- | gitdb/test/db/test_ref.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gitdb/test/db/test_ref.py b/gitdb/test/db/test_ref.py index 6bac245..2049698 100644 --- a/gitdb/test/db/test_ref.py +++ b/gitdb/test/db/test_ref.py @@ -21,10 +21,9 @@ class TestReferenceDB(TestDBBase): def make_alt_file(self, alt_path, alt_list): """Create an alternates file which contains the given alternates. The list can be empty""" - alt_file = open(alt_path, "wb") - for alt in alt_list: - alt_file.write(alt.encode("utf-8") + "\n".encode("ascii")) - alt_file.close() + with open(alt_path, "wb") as alt_file: + for alt in alt_list: + alt_file.write(alt.encode("utf-8") + "\n".encode("ascii")) @with_rw_directory def test_writing(self, path): |
