Rev 5356: Cleanup bt.test_branch. in file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Jul 21 17:50:08 BST 2010


At file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/

------------------------------------------------------------
revno: 5356
revision-id: v.ladeuil+lp at free.fr-20100721165008-6xfd2mv9w2banwbb
parent: v.ladeuil+lp at free.fr-20100721164401-m6v9p8b2sdebr7yj
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: further-cleanups
timestamp: Wed 2010-07-21 18:50:08 +0200
message:
  Cleanup bt.test_branch.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py	2010-06-20 21:14:49 +0000
+++ b/bzrlib/tests/test_branch.py	2010-07-21 16:50:08 +0000
@@ -86,18 +86,8 @@
         self.assertIsDirectory('.bzr/branch/lock/held', t)
 
     def test_set_push_location(self):
-        from bzrlib.config import (locations_config_filename,
-                                   ensure_config_dir_exists)
-        ensure_config_dir_exists()
-        fn = locations_config_filename()
-        # write correct newlines to locations.conf
-        # by default ConfigObj uses native line-endings for new files
-        # but uses already existing line-endings if file is not empty
-        f = open(fn, 'wb')
-        try:
-            f.write('# comment\n')
-        finally:
-            f.close()
+        conf = config.LocationConfig('.', _content='# comment\n')
+        conf._write_config_file()
 
         branch = self.make_branch('.', format='knit')
         branch.set_push_location('foo')
@@ -106,7 +96,7 @@
                              "[%s]\n"
                              "push_location = foo\n"
                              "push_location:policy = norecurse\n" % local_path,
-                             fn)
+                             config.locations_config_filename())
 
     # TODO RBC 20051029 test getting a push location from a branch in a
     # recursive section - that is, it appends the branch name.



More information about the bazaar-commits mailing list