Merge lp:~vila/bzr/restore-safety-net-home-check into lp:bzr

Proposed by Vincent Ladeuil
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 6552
Proposed branch: lp:~vila/bzr/restore-safety-net-home-check
Merge into: lp:bzr
Diff against target: 27 lines (+10/-7)
1 file modified
bzrlib/tests/__init__.py (+10/-7)
To merge this branch: bzr merge lp:~vila/bzr/restore-safety-net-home-check
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+118050@code.launchpad.net

Commit message

Restores the HOME check around creating the test safety net

Description of the change

This restores the HOME check around creating the test safety net lost circa
revno 6214 (most probably accidentally).

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/3/2012 10:10 AM, Vincent Ladeuil wrote:
> Vincent Ladeuil has proposed merging
> lp:~vila/bzr/restore-safety-net-home-check into lp:bzr.
>
> Requested reviews: bzr-core (bzr-core)
>
> For more details, see:
> https://code.launchpad.net/~vila/bzr/restore-safety-net-home-check/+merge/118050
>
> This restores the HOME check around creating the test safety net
> lost circa revno 6214 (most probably accidentally).
>

I'm guessing we might still want to raise the exception.

Otherwise:

 merge: approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAbkBEACgkQJdeBCYSNAAOurgCfTiQNyP5CaLlKkA2iJ5w2O2RB
HiUAniOXadxC+6uF6YyYtsDU/HQ/xbMg
=UFl6
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

> I'm guessing we might still want to raise the exception.

At best, the test runner will catch it and fail the test anyway. Failing it here ensures we get the proper reason.

Revision history for this message
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Revision history for this message
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Revision history for this message
Robert Collins (lifeless) wrote :

I don't understand how it restores anything - AFAICT all you change is
that you catch Exception and call self.fail .... both will fail the
test run ;)

Revision history for this message
Vincent Ladeuil (vila) wrote :

> I don't understand how it restores anything

bzr diff -r6213..6214 bzrlib/tests/__init__.py

Revision history for this message
Robert Collins (lifeless) wrote :

On Fri, Aug 3, 2012 at 11:31 PM, Vincent Ladeuil <email address hidden> wrote:
>> I don't understand how it restores anything
>
> bzr diff -r6213..6214 bzrlib/tests/__init__.py

Yes, you're reversing the diff of that patch. Thats orthogonal to my point.

Revision history for this message
Vincent Ladeuil (vila) wrote :

> AFAICT all you change is that you catch Exception and call self.fail

Indeed.

> both will fail the test run ;)

Of course. But the failure message will be clearer and points to the very unlikely cause of the failure instead of a random generic one which was the point of the original patch. http://pad.lv/825027 and the associated proposal contain all the details if you care about them.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/__init__.py'
2--- bzrlib/tests/__init__.py 2012-06-18 11:43:07 +0000
3+++ bzrlib/tests/__init__.py 2012-08-03 09:38:21 +0000
4@@ -2595,13 +2595,16 @@
5 real branch.
6 """
7 root = TestCaseWithMemoryTransport.TEST_ROOT
8- # Make sure we get a readable and accessible home for .bzr.log
9- # and/or config files, and not fallback to weird defaults (see
10- # http://pad.lv/825027).
11- self.assertIs(None, os.environ.get('BZR_HOME', None))
12- os.environ['BZR_HOME'] = root
13- wt = controldir.ControlDir.create_standalone_workingtree(root)
14- del os.environ['BZR_HOME']
15+ try:
16+ # Make sure we get a readable and accessible home for .bzr.log
17+ # and/or config files, and not fallback to weird defaults (see
18+ # http://pad.lv/825027).
19+ self.assertIs(None, os.environ.get('BZR_HOME', None))
20+ os.environ['BZR_HOME'] = root
21+ wt = controldir.ControlDir.create_standalone_workingtree(root)
22+ del os.environ['BZR_HOME']
23+ except Exception, e:
24+ self.fail("Fail to initialize the safety net: %r\n" % (e,))
25 # Hack for speed: remember the raw bytes of the dirstate file so that
26 # we don't need to re-open the wt to check it hasn't changed.
27 TestCaseWithMemoryTransport._SAFETY_NET_PRISTINE_DIRSTATE = (