Rev 6503: Fix failing tests, they were either brittle or requiring the config to be saved. in file:///home/vila/src/bzr/bugs/832042-shared-stores/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Jul 31 12:59:58 UTC 2012


At file:///home/vila/src/bzr/bugs/832042-shared-stores/

------------------------------------------------------------
revno: 6503
revision-id: v.ladeuil+lp at free.fr-20120731125958-3rel138uwivson08
parent: v.ladeuil+lp at free.fr-20120731092202-qh9fs6q4p7y4qqmy
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 832042-shared-stores
timestamp: Tue 2012-07-31 14:59:58 +0200
message:
  Fix failing tests, they were either brittle or requiring the config to be saved.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2012-07-31 09:22:02 +0000
+++ b/bzrlib/config.py	2012-07-31 12:59:58 +0000
@@ -3433,7 +3433,8 @@
             for k, store in stores.iteritems():
                 store.save_changes()
         if _once:
-            # FIXME: Ugly hack waiting for library_state to always be available.
+            # FIXME: Ugly hack waiting for library_state to always be
+            # available. -- vila 20120731
             import atexit
             atexit.register(save_config_changes)
             _once = False

=== modified file 'bzrlib/plugins/launchpad/test_register.py'
--- a/bzrlib/plugins/launchpad/test_register.py	2012-02-14 17:22:37 +0000
+++ b/bzrlib/plugins/launchpad/test_register.py	2012-07-31 12:59:58 +0000
@@ -331,6 +331,9 @@
         service = LaunchpadService()
         g_conf = config.GlobalStack()
         g_conf.set('email', 'Test User <test at user.com>')
+        g_conf.store.save()
+        # FIXME: auth_path base dir exists only because bazaar.conf has just
+        # been saved, brittle... -- vila 20120731
         f = open(auth_path, 'wb')
         try:
             scheme, hostinfo = urlparse.urlsplit(service.service_url)[:2]
@@ -352,6 +355,7 @@
         self.assertIs(None, service.registrant_password)
         g_conf = config.GlobalStack()
         g_conf.set('email', 'Test User <test at user.com>')
+        g_conf.store.save()
         stdout = tests.StringIOWrapper()
         stderr = tests.StringIOWrapper()
         ui.ui_factory = tests.TestUIFactory(stdin='userpass\n',

=== modified file 'bzrlib/tests/blackbox/test_serve.py'
--- a/bzrlib/tests/blackbox/test_serve.py	2012-03-06 17:17:27 +0000
+++ b/bzrlib/tests/blackbox/test_serve.py	2012-07-31 12:59:58 +0000
@@ -274,6 +274,8 @@
     def test_bzr_serve_supports_configurable_timeout(self):
         gs = config.GlobalStack()
         gs.set('serve.client_timeout', 0.2)
+        # Set the config as the subprocess will use it
+        gs.store.save()
         process, url = self.start_server_port()
         self.build_tree_contents([('a_file', 'contents\n')])
         # We can connect and issue a request
@@ -281,9 +283,6 @@
         self.assertEqual('contents\n', t.get_bytes('a_file'))
         # However, if we just wait for more content from the server, it will
         # eventually disconnect us.
-        # TODO: Use something like signal.alarm() so that if the server doesn't
-        #       properly handle the timeout, we end up failing the test instead
-        #       of hanging forever.
         m = t.get_smart_medium()
         m.read_bytes(1)
         # Now, we wait for timeout to trigger



More information about the bazaar-commits mailing list