Do not contest locks in PythonGit

The config writer should be
used in a context manager form to ensure locks are shared and
the data is properly written out. In python 2 it looks as if
the locks were not properly handled and multiple config
writers would just lock the same file (and write) blindly.
In python 3, the context manager is required to not raise
an exception when writing the config due to the lock already
being held by another config_writer.

Change-Id: I42a9804638c6065127ce31a1865b017bf969855f
diff --git a/tests/base.py b/tests/base.py
index a3c9242..c5ea320 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -1169,9 +1169,9 @@
         path = os.path.join(self.upstream_root, project)
         repo = git.Repo.init(path)
 
-        repo.config_writer().set_value('user', 'email', 'user@example.com')
-        repo.config_writer().set_value('user', 'name', 'User Name')
-        repo.config_writer().write()
+        with repo.config_writer() as config_writer:
+            config_writer.set_value('user', 'email', 'user@example.com')
+            config_writer.set_value('user', 'name', 'User Name')
 
         fn = os.path.join(path, 'README')
         f = open(fn, 'w')