diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-02 14:26:15 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-04 02:11:31 +0200 |
commit | 8a2f7dce43617b773a6be425ea155812396d3856 (patch) | |
tree | 17ad88b4f1e7185b55f53074c39945015bc5611b /git/test/test_remote.py | |
parent | a469af892b3e929cbe9d29e414b6fcd59bec246e (diff) | |
download | gitpython-8a2f7dce43617b773a6be425ea155812396d3856.tar.gz |
io: Wrap (probably) allconfig_writers in `with` blocks
Diffstat (limited to 'git/test/test_remote.py')
-rw-r--r-- | git/test/test_remote.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/git/test/test_remote.py b/git/test/test_remote.py index 3fd71a1f..7b52ccce 100644 --- a/git/test/test_remote.py +++ b/git/test/test_remote.py @@ -267,7 +267,8 @@ class TestRemote(TestBase): # put origin to git-url other_origin = other_repo.remotes.origin - other_origin.config_writer.set("url", remote_repo_url) + with other_origin.config_writer as cw: + cw.set("url", remote_repo_url) # it automatically creates alternates as remote_repo is shared as well. # It will use the transport though and ignore alternates when fetching # assert not other_repo.alternates # this would fail @@ -416,13 +417,12 @@ class TestRemote(TestBase): self.failUnlessRaises(IOError, reader.set, opt, "test") # change value - writer = remote.config_writer - new_val = "myval" - writer.set(opt, new_val) - assert writer.get(opt) == new_val - writer.set(opt, val) - assert writer.get(opt) == val - del(writer) + with remote.config_writer as writer: + new_val = "myval" + writer.set(opt, new_val) + assert writer.get(opt) == new_val + writer.set(opt, val) + assert writer.get(opt) == val assert getattr(remote, opt) == val # END for each default option key |