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
1=== modified file 'lib/devscripts/ec2test/instance.py'
2--- lib/devscripts/ec2test/instance.py 2009-11-26 20:59:16 +0000
3+++ lib/devscripts/ec2test/instance.py 2009-11-27 07:30:29 +0000
4@@ -22,7 +22,6 @@
5
6 import paramiko
7
8-from devscripts.ec2test.credentials import EC2Credentials
9 from devscripts.ec2test.session import EC2SessionName
10
11
12@@ -193,11 +192,17 @@
13 to allow access to the instance.
14 :param credentials: An `EC2Credentials` object.
15 """
16- # XXX JeroenVermeulen 2009-11-26: This import fails when
17- # testing without a real EC2 instance. Do it here so the test
18- # can still import this class.
19+ # This import breaks in the test environment. Do it here so
20+ # that unit tests (which don't use this factory) can still
21+ # import EC2Instance.
22 from bzrlib.plugins.launchpad.account import get_lp_login
23
24+ # XXX JeroenVermeulen 2009-11-27 bug=489073: EC2Credentials
25+ # imports boto, which isn't necessarily installed in our test
26+ # environment. Doing the import here so that unit tests (which
27+ # don't use this factory) can still import EC2Instance.
28+ from devscripts.ec2test.credentials import EC2Credentials
29+
30 assert isinstance(name, EC2SessionName)
31 if instance_type not in AVAILABLE_INSTANCE_TYPES:
32 raise ValueError('unknown instance_type %s' % (instance_type,))