Rev 5794: Restrict the scope when testing hooks to avoid spurious failures. in file:///home/vila/src/bzr/experimental/config/

Vincent Ladeuil v.ladeuil+lp at free.fr
Sun Jun 12 17:01:38 UTC 2011


At file:///home/vila/src/bzr/experimental/config/

------------------------------------------------------------
revno: 5794
revision-id: v.ladeuil+lp at free.fr-20110612170137-yew3ljk8odooc1ff
parent: v.ladeuil+lp at free.fr-20110610131434-5mlt2npfpvzmn65l
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: config-hooks
timestamp: Sun 2011-06-12 19:01:37 +0200
message:
  Restrict the scope when testing hooks to avoid spurious failures.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2011-06-10 13:14:34 +0000
+++ b/bzrlib/tests/test_config.py	2011-06-12 17:01:37 +0000
@@ -2174,12 +2174,12 @@
         section.set('foo', 'bar')
         store.save()
         # Now we can try to load it
+        store = self.get_store(self)
         calls = []
         def hook(*args):
             calls.append(args)
         config.ConfigHooks.install_named_hook('load', hook, None)
         self.assertLength(0, calls)
-        store = self.get_store(self)
         store.load()
         self.assertLength(1, calls)
         self.assertEquals((store,), calls[0])
@@ -2554,13 +2554,13 @@
         self.assertEquals(None, conf.get('foo'))
 
     def test_get_hook(self):
+        conf = self.get_stack(self)
+        conf.store._load_from_string('foo=bar')
         calls = []
         def hook(*args):
             calls.append(args)
         config.ConfigHooks.install_named_hook('get', hook, None)
         self.assertLength(0, calls)
-        conf = self.get_stack(self)
-        conf.store._load_from_string('foo=bar')
         value = conf.get('foo')
         self.assertEquals('bar', value)
         self.assertLength(1, calls)



More information about the bazaar-commits mailing list