Rev 6043: Avoid exit(), use self.fail(). in file:///home/vila/src/bzr/bugs/825027-safety-net-is-brittle/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Aug 31 06:22:52 UTC 2011


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

------------------------------------------------------------
revno: 6043
revision-id: v.ladeuil+lp at free.fr-20110831062252-emvucu4i4goc8s1m
parent: v.ladeuil+lp at free.fr-20110830143511-g84do8k5k814gjjm
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 825027-safety-net-is-brittle
timestamp: Wed 2011-08-31 08:22:52 +0200
message:
  Avoid exit(), use self.fail().
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2011-08-30 14:09:00 +0000
+++ b/bzrlib/tests/__init__.py	2011-08-31 06:22:52 +0000
@@ -2538,16 +2538,15 @@
         """
         root = TestCaseWithMemoryTransport.TEST_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).
+            # Make sure we get a readable and accessible home for .bzr.log
+            # and/or 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)
+            self.fail("Fail to initialize the safety net: %r\nExiting\n" % (e,))
         # 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