Rev 6041: Be more robust when creating the test safety net and abort otherwise in file:///home/vila/src/bzr/bugs/825027-safety-net-is-brittle/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Aug 30 14:09:00 UTC 2011


At file:///home/vila/src/bzr/bugs/825027-safety-net-is-brittle/

------------------------------------------------------------
revno: 6041
revision-id: v.ladeuil+lp at free.fr-20110830140900-l1mcqtclpke5az7r
parent: pqm at pqm.ubuntu.com-20110830094437-y5wu3f1jio1h70jo
fixes bug(s): https://launchpad.net/bugs/825027
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 825027-safety-net-is-brittle
timestamp: Tue 2011-08-30 16:09:00 +0200
message:
  Be more robust when creating the test safety net and abort otherwise
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2011-08-09 09:11:17 +0000
+++ b/bzrlib/tests/__init__.py	2011-08-30 14:09:00 +0000
@@ -2537,7 +2537,17 @@
         real branch.
         """
         root = TestCaseWithMemoryTransport.TEST_ROOT
-        wt = bzrdir.BzrDir.create_standalone_workingtree(root)
+        try:
+            # Make sure we get a readable and accessible home for config files,
+            # and not fallback to weird defaults (see http://pad.lv/825027).
+            self.assertIs(None, os.environ.get('BZR_HOME', None))
+            os.environ['BZR_HOME'] = root
+            wt = bzrdir.BzrDir.create_standalone_workingtree(root)
+            del os.environ['BZR_HOME']
+        except Exception, e:
+            sys.stderr.write("Fail to initialize the safety net: %r\nExiting\n"
+                             % (e,))
+            sys.exit(1)
         # Hack for speed: remember the raw bytes of the dirstate file so that
         # we don't need to re-open the wt to check it hasn't changed.
         TestCaseWithMemoryTransport._SAFETY_NET_PRISTINE_DIRSTATE = (



More information about the bazaar-commits mailing list