summaryrefslogtreecommitdiff
path: root/git/test/test_refs.py
diff options
context:
space:
mode:
authorKostis Anagnostopoulos <ankostis@gmail.com>2016-10-02 14:26:15 +0200
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-10-04 02:11:31 +0200
commit8a2f7dce43617b773a6be425ea155812396d3856 (patch)
tree17ad88b4f1e7185b55f53074c39945015bc5611b /git/test/test_refs.py
parenta469af892b3e929cbe9d29e414b6fcd59bec246e (diff)
downloadgitpython-8a2f7dce43617b773a6be425ea155812396d3856.tar.gz
io: Wrap (probably) allconfig_writers in `with` blocks
Diffstat (limited to 'git/test/test_refs.py')
-rw-r--r--git/test/test_refs.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/git/test/test_refs.py b/git/test/test_refs.py
index 00b5232a..43f1dcc7 100644
--- a/git/test/test_refs.py
+++ b/git/test/test_refs.py
@@ -101,15 +101,13 @@ class TestRefs(TestBase):
assert prev_object == cur_object # represent the same git object
assert prev_object is not cur_object # but are different instances
- writer = head.config_writer()
- tv = "testopt"
- writer.set_value(tv, 1)
- assert writer.get_value(tv) == 1
- writer.release()
+ with head.config_writer() as writer:
+ tv = "testopt"
+ writer.set_value(tv, 1)
+ assert writer.get_value(tv) == 1
assert head.config_reader().get_value(tv) == 1
- writer = head.config_writer()
- writer.remove_option(tv)
- writer.release()
+ with head.config_writer() as writer:
+ writer.remove_option(tv)
# after the clone, we might still have a tracking branch setup
head.set_tracking_branch(None)
@@ -175,7 +173,7 @@ class TestRefs(TestBase):
def test_orig_head(self):
assert type(self.rorepo.head.orig_head()) == SymbolicReference
-
+
@with_rw_repo('0.1.6')
def test_head_checkout_detached_head(self, rw_repo):
res = rw_repo.remotes.origin.refs.master.checkout()