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/lib/helper.py | |
parent | a469af892b3e929cbe9d29e414b6fcd59bec246e (diff) | |
download | gitpython-8a2f7dce43617b773a6be425ea155812396d3856.tar.gz |
io: Wrap (probably) allconfig_writers in `with` blocks
Diffstat (limited to 'git/test/lib/helper.py')
-rw-r--r-- | git/test/lib/helper.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index 3c9374e7..e92ce8b4 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -237,16 +237,13 @@ def with_rw_and_rw_remote_repo(working_tree_ref): rw_remote_repo.daemon_export = True # this thing is just annoying ! - crw = rw_remote_repo.config_writer() - section = "daemon" - try: - crw.add_section(section) - except Exception: - pass - crw.set(section, "receivepack", True) - # release lock - crw.release() - del(crw) + with rw_remote_repo.config_writer() as crw: + section = "daemon" + try: + crw.add_section(section) + except Exception: + pass + crw.set(section, "receivepack", True) # initialize the remote - first do it as local remote and pull, then # we change the url to point to the daemon. The daemon should be started @@ -255,7 +252,8 @@ def with_rw_and_rw_remote_repo(working_tree_ref): d_remote.fetch() remote_repo_url = "git://localhost:%s%s" % (GIT_DAEMON_PORT, remote_repo_dir) - d_remote.config_writer.set('url', remote_repo_url) + with d_remote.config_writer as cw: + cw.set('url', remote_repo_url) temp_dir = osp(_mktemp()) gd = launch_git_daemon(temp_dir, '127.0.0.1', GIT_DAEMON_PORT) |