Merge lp:~thomir-deactivatedaccount/autopilot/fix-for-1171303 into lp:autopilot

Proposed by Thomi Richards
Status: Merged
Approved by: Christopher Lee
Approved revision: 170
Merged at revision: 169
Proposed branch: lp:~thomir-deactivatedaccount/autopilot/fix-for-1171303
Merge into: lp:autopilot
Diff against target: 57 lines (+24/-3)
2 files modified
autopilot/testcase.py (+7/-3)
autopilot/tests/test_ap_apps.py (+17/-0)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/autopilot/fix-for-1171303
Reviewer Review Type Date Requested Status
Christopher Lee (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+160257@code.launchpad.net

Commit message

Fix exception formatting.

Description of the change

This branch fixes two separate, yet related issues:
 * When launching an aplication for introspection, if the introspection type cannot be determined, autopilot rauses a RuntimeException. The string formatting in the exceptions message was bad (it contained lots of whitesapce).
 * When launching an aplication for introspection, passing a non-dynamically linked executable would raise a RuntimeError, but with the wrong message.

To post a comment you must log in.
170. By Thomi Richards

Fixed more tests.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Christopher Lee (veebers) wrote :

looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'autopilot/testcase.py'
2--- autopilot/testcase.py 2013-04-22 05:06:14 +0000
3+++ autopilot/testcase.py 2013-04-23 04:02:27 +0000
4@@ -258,11 +258,15 @@
5 """
6 app_path = subprocess.check_output(['which',application]).strip()
7 # Get a launcher, tests can override this if they need:
8- launcher = self.pick_app_launcher(app_path)
9+ launcher = None
10+ try:
11+ launcher = self.pick_app_launcher(app_path)
12+ except RuntimeError:
13+ pass
14 if launcher is None:
15 raise RuntimeError("Autopilot could not determine the correct \
16- introspection type to use. You can specify one by overriding \
17- the AutopilotTestCase.pick_app_launcher method.")
18+introspection type to use. You can specify one by overriding the \
19+AutopilotTestCase.pick_app_launcher method.")
20 process = launch_application(launcher, app_path, *arguments, **kwargs)
21 self.addCleanup(self._kill_process_and_attach_logs, process)
22 return get_autopilot_proxy_object_for_process(process)
23
24=== modified file 'autopilot/tests/test_ap_apps.py'
25--- autopilot/tests/test_ap_apps.py 2013-04-22 03:47:55 +0000
26+++ autopilot/tests/test_ap_apps.py 2013-04-23 04:02:27 +0000
27@@ -10,6 +10,7 @@
28 import stat
29 import subprocess
30 from tempfile import mktemp
31+from testtools.matchers import raises
32 from textwrap import dedent
33
34 from autopilot.testcase import AutopilotTestCase
35@@ -31,6 +32,22 @@
36 return path
37
38
39+class ApplicationLaunchTests(ApplicationTests):
40+
41+ def test_unknown_app_exception(self):
42+ """launch_test_app must raise a RuntimeError when asked to launch an
43+ application that has an unknown introspection type.
44+
45+ """
46+ path = self.write_script("")
47+ expected_error_message = "Autopilot could not determine the correct \
48+introspection type to use. You can specify one by overriding the \
49+AutopilotTestCase.pick_app_launcher method."
50+
51+ self.assertThat(lambda: self.launch_test_application(path),
52+ raises(RuntimeError(expected_error_message)))
53+
54+
55 class QtTests(ApplicationTests):
56
57 def setUp(self):

Subscribers

People subscribed via source and target branches