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
=== modified file 'lib/lp/testing/__init__.py'
--- lib/lp/testing/__init__.py 2011-03-08 15:14:54 +0000
+++ lib/lp/testing/__init__.py 2011-03-09 04:01:29 +0000
@@ -793,10 +793,13 @@
793class WebServiceTestCase(TestCaseWithFactory):793class WebServiceTestCase(TestCaseWithFactory):
794 """Test case optimized for testing the web service using launchpadlib."""794 """Test case optimized for testing the web service using launchpadlib."""
795795
796 #avoid circular imports796 @property
797 from canonical.testing.layers import AppServerLayer797 def layer(self):
798798 # XXX wgrant 2011-03-09 bug=505913:
799 layer = AppServerLayer799 # TestTwistedJobRunner.test_timeout fails if this is at the
800 # module level. There is probably some hidden circular import.
801 from canonical.testing.layers import AppServerLayer
802 return AppServerLayer
800803
801 def setUp(self):804 def setUp(self):
802 super(WebServiceTestCase, self).setUp()805 super(WebServiceTestCase, self).setUp()