summaryrefslogtreecommitdiff
path: root/test/git/test_config.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-19 15:03:44 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-19 15:03:44 +0200
commit26029c29765043376370a2877b7e635c17f5e76d (patch)
tree1a0ce488e628df94f61048e1e9c691c59a83e867 /test/git/test_config.py
parent3fd37230e76a014cf5c45d55daf0be2caa6948b7 (diff)
downloadgitpython-26029c29765043376370a2877b7e635c17f5e76d.tar.gz
added additional testing for the configuration, concurrent access and config reading, all tests work
Diffstat (limited to 'test/git/test_config.py')
-rw-r--r--test/git/test_config.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/test/git/test_config.py b/test/git/test_config.py
index c3080fb0..c5a8dc2c 100644
--- a/test/git/test_config.py
+++ b/test/git/test_config.py
@@ -36,6 +36,29 @@ class TestBase(TestCase):
assert w_config._sections
w_config.write() # enforce writing
assert file_obj.getvalue() == file_obj_orig.getvalue()
+
+ # creating an additional config writer must fail due to exclusive access
+ self.failUnlessRaises(IOError, GitConfigParser, file_obj, read_only = False)
+
+ # should still have a lock and be able to make changes
+ assert w_config._has_lock()
+
+ # changes should be written right away
+ sname = "my_section"
+ oname = "mykey"
+ val = "myvalue"
+ w_config.add_section(sname)
+ assert w_config.has_section(sname)
+ w_config.set(sname, oname, val)
+ assert w_config.has_option(sname,oname)
+ assert w_config.get(sname, oname) == val
+
+ file_obj.seek(0)
+ r_config = GitConfigParser(file_obj, read_only=True)
+ assert r_config.has_section(sname)
+ assert r_config.has_option(sname, oname)
+ assert r_config.get(sname, oname) == val
+
# END for each filename
def test_base(self):
@@ -64,5 +87,3 @@ class TestBase(TestCase):
assert num_sections and num_options
assert r_config._is_initialized == True
-
- self.fail("TODO: Base config writer testing")