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_docs.py | |
parent | a469af892b3e929cbe9d29e414b6fcd59bec246e (diff) | |
download | gitpython-8a2f7dce43617b773a6be425ea155812396d3856.tar.gz |
io: Wrap (probably) allconfig_writers in `with` blocks
Diffstat (limited to 'git/test/test_docs.py')
-rw-r--r-- | git/test/test_docs.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/git/test/test_docs.py b/git/test/test_docs.py index 5c7ae7f0..e2bfcb21 100644 --- a/git/test/test_docs.py +++ b/git/test/test_docs.py @@ -39,8 +39,8 @@ class Tutorials(TestBase): # [3-test_init_repo_object] repo.config_reader() # get a config reader for read-only access - cw = repo.config_writer() # get a config writer to change configuration - cw.release() # call release() to be sure changes are written and locks are released + with repo.config_writer(): # get a config writer to change configuration + pass # call release() to be sure changes are written and locks are released # ![3-test_init_repo_object] # [4-test_init_repo_object] @@ -398,9 +398,8 @@ class Tutorials(TestBase): # [26-test_references_and_objects] assert origin.url == repo.remotes.origin.url - cw = origin.config_writer - cw.set("pushurl", "other_url") - cw.release() + with origin.config_writer as cw: + cw.set("pushurl", "other_url") # Please note that in python 2, writing origin.config_writer.set(...) is totally safe. # In py3 __del__ calls can be delayed, thus not writing changes in time. |