Merge lp:~wgrant/launchpad/testfix into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 12557
Proposed branch: lp:~wgrant/launchpad/testfix
Merge into: lp:launchpad
Diff against target: 21 lines (+7/-4)
1 file modified
lib/lp/testing/__init__.py (+7/-4)
To merge this branch: bzr merge lp:~wgrant/launchpad/testfix
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Steve Kowalik (community) code* Approve
Review via email: mp+52632@code.launchpad.net

Commit message

[r=lifeless,stevenk][no-qa] "Really avoid a circular import in lp.testing... canonical.testing.layers imports kill TwistedJobRunner.test_timeout."

Description of the change

TestTwistedJobRunner.test_timeout fails in very unobvious ways if canonical.testing.layers is imported by lp.testing. This branch fixes r12555 to not do that.

To post a comment you must log in.
Revision history for this message
Steve Kowalik (stevenk) wrote :

I agree that there is something hidden going on that Twisted is masking, but thank you for the workaround.

review: Approve (code*)
Revision history for this message
Robert Collins (lifeless) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/testing/__init__.py'
2--- lib/lp/testing/__init__.py 2011-03-08 15:14:54 +0000
3+++ lib/lp/testing/__init__.py 2011-03-09 04:01:29 +0000
4@@ -793,10 +793,13 @@
5 class WebServiceTestCase(TestCaseWithFactory):
6 """Test case optimized for testing the web service using launchpadlib."""
7
8- #avoid circular imports
9- from canonical.testing.layers import AppServerLayer
10-
11- layer = AppServerLayer
12+ @property
13+ def layer(self):
14+ # XXX wgrant 2011-03-09 bug=505913:
15+ # TestTwistedJobRunner.test_timeout fails if this is at the
16+ # module level. There is probably some hidden circular import.
17+ from canonical.testing.layers import AppServerLayer
18+ return AppServerLayer
19
20 def setUp(self):
21 super(WebServiceTestCase, self).setUp()