Merge lp:~benji/launchpad/bug-954319 into lp:launchpad

Proposed by Benji York
Status: Merged
Approved by: Benji York
Approved revision: no longer in the source branch.
Merged at revision: 14954
Proposed branch: lp:~benji/launchpad/bug-954319
Merge into: lp:launchpad
Diff against target: 28 lines (+3/-1)
1 file modified
lib/lp/services/database/tests/test_readonly.py (+3/-1)
To merge this branch: bzr merge lp:~benji/launchpad/bug-954319
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+97491@code.launchpad.net

Commit message

fix a test isolation bug that causes read-only mode to get stuck on when the test are run in a semi-random order (as when running them in parallel)

Description of the change

This branch fixes a test isolation bug that causes read-only mode to get stuck on when the test are run in a semi-random order (as when running them in parallel).

The problem is that a test request was leaking out of these tests so the fix was to end the current interaction in the tearDown.

Both the subset of the tests that exhibited the problem (see linked bug) and a much larger test run (comprising half of all the tests) nolonger provke the bug.

I also fixed a bit trailing whitespace lint in lib/lp/services/database/tests/test_readonly.py.

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/services/database/tests/test_readonly.py'
2--- lib/lp/services/database/tests/test_readonly.py 2012-01-01 02:58:52 +0000
3+++ lib/lp/services/database/tests/test_readonly.py 2012-03-14 19:07:25 +0000
4@@ -4,6 +4,7 @@
5 __metaclass__ = type
6
7 from lazr.restful.utils import get_current_browser_request
8+from zope.security.management import endInteraction
9
10 from lp.services.database.readonly import (
11 is_read_only,
12@@ -48,6 +49,7 @@
13 # Safety net just in case a test leaves the read-only.txt file behind.
14 if read_only_file_exists():
15 remove_read_only_file()
16+ endInteraction()
17 super(Test_is_read_only, self).tearDown()
18
19 def test_is_read_only(self):
20@@ -75,7 +77,7 @@
21 self.assertFalse(
22 request.annotations.get(READ_ONLY_MODE_ANNOTATIONS_KEY))
23
24- def test_cached_value_takes_precedence(self):
25+ def test_cached_value_takes_precedence(self):
26 # Once the request has the read-only flag, we don't check for the
27 # presence of the read-only.txt file anymore, so it could be removed
28 # and the request would still be in read-only mode.