Merge lp:~jtv/launchpad/bug-489068 into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~jtv/launchpad/bug-489068
Merge into: lp:launchpad
Diff against target: 32 lines (+9/-4)
1 file modified
lib/devscripts/ec2test/instance.py (+9/-4)
To merge this branch: bzr merge lp:~jtv/launchpad/bug-489068
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Michael Hudson-Doyle code Pending
Review via email: mp+15309@code.launchpad.net

Commit message

Work around import problem in strict test environment (bug 489073).

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

= Bug 489068 =

Testfix branch.

My test for the EC2 breakage (bug 488695) is breaking because credentials.py imports boto, which apparently isnt' available in our test environment.

Luckily, the import from credentials.py is only needed in the one factory method that my test doesn't use. So as I did with get_lp_login, I can move the import into that factory. That way the test skips them.

{{{
./bin/test -vv -t ec2instance
}}}

Jeroen

Revision history for this message
Stuart Bishop (stub) wrote :

I'd like a bug open getting this package we use added to one of the launchpad dependency packages.

If the comment remains an XXX, it should reference this bug. Otherwise, make it a normal comment as there is nothing to fix here.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/devscripts/ec2test/instance.py'
--- lib/devscripts/ec2test/instance.py 2009-11-26 20:59:16 +0000
+++ lib/devscripts/ec2test/instance.py 2009-11-27 07:30:29 +0000
@@ -22,7 +22,6 @@
2222
23import paramiko23import paramiko
2424
25from devscripts.ec2test.credentials import EC2Credentials
26from devscripts.ec2test.session import EC2SessionName25from devscripts.ec2test.session import EC2SessionName
2726
2827
@@ -193,11 +192,17 @@
193 to allow access to the instance.192 to allow access to the instance.
194 :param credentials: An `EC2Credentials` object.193 :param credentials: An `EC2Credentials` object.
195 """194 """
196 # XXX JeroenVermeulen 2009-11-26: This import fails when195 # This import breaks in the test environment. Do it here so
197 # testing without a real EC2 instance. Do it here so the test196 # that unit tests (which don't use this factory) can still
198 # can still import this class.197 # import EC2Instance.
199 from bzrlib.plugins.launchpad.account import get_lp_login198 from bzrlib.plugins.launchpad.account import get_lp_login
200199
200 # XXX JeroenVermeulen 2009-11-27 bug=489073: EC2Credentials
201 # imports boto, which isn't necessarily installed in our test
202 # environment. Doing the import here so that unit tests (which
203 # don't use this factory) can still import EC2Instance.
204 from devscripts.ec2test.credentials import EC2Credentials
205
201 assert isinstance(name, EC2SessionName)206 assert isinstance(name, EC2SessionName)
202 if instance_type not in AVAILABLE_INSTANCE_TYPES:207 if instance_type not in AVAILABLE_INSTANCE_TYPES:
203 raise ValueError('unknown instance_type %s' % (instance_type,))208 raise ValueError('unknown instance_type %s' % (instance_type,))