Merge lp:~thomir-deactivatedaccount/window-mocker/make-windows-autopilot-compatible into lp:window-mocker

Proposed by Thomi Richards
Status: Merged
Approved by: Christopher Lee
Approved revision: 19
Merged at revision: 18
Proposed branch: lp:~thomir-deactivatedaccount/window-mocker/make-windows-autopilot-compatible
Merge into: lp:window-mocker
Diff against target: 76 lines (+27/-4)
3 files modified
bin/window-mocker (+4/-0)
tests/test_app_functional.py (+19/-3)
windowmocker/plugins/qt.py (+4/-1)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/window-mocker/make-windows-autopilot-compatible
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Christopher Lee (community) Approve
Review via email: mp+160223@code.launchpad.net

Commit message

Make window-mocker windows introspectable from autopilot.

Description of the change

This branch adds a command line option '-testability' to the window-mocker process, making it compatible with the autopilot/Qt introspection plugin.

To post a comment you must log in.
Revision history for this message
Christopher Lee (veebers) wrote :

Looks good.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/window-mocker'
2--- bin/window-mocker 2013-02-07 16:41:10 +0000
3+++ bin/window-mocker 2013-04-22 22:35:33 +0000
4@@ -42,6 +42,10 @@
5 parser.add_argument('-t', '--type', choices=get_registered_plugin_names(),
6 default=get_default_plugin_name, help="""Select the application type."""
7 )
8+ parser.add_argument('-testability', action='store_true',
9+ help="""Enable autopilot introspection. Only applies when the Qt plugin
10+ is used."""
11+ )
12 return parser
13
14
15
16=== modified file 'tests/test_app_functional.py'
17--- tests/test_app_functional.py 2013-02-07 16:41:10 +0000
18+++ tests/test_app_functional.py 2013-04-22 22:35:33 +0000
19@@ -11,8 +11,9 @@
20 import os.path
21 import subprocess
22 import tempfile
23+from time import sleep
24 from testtools import TestCase
25-from testtools.matchers import Equals
26+from testtools.matchers import Contains, Equals
27
28
29 def get_app_path():
30@@ -51,9 +52,19 @@
31 shell=False
32 )
33
34+ stdout = stderr = ""
35+ for i in range(10):
36+ retcode = process.poll()
37+ if retcode is not None:
38+ break
39+ if i == 5:
40+ print "Killing process."
41+ process.kill()
42+ if i == 8:
43+ print "Terminating process."
44+ process.terminate()
45+ sleep(1)
46 stdout, stderr = process.communicate()
47- retcode = process.poll()
48-
49 return (retcode, stdout, stderr)
50
51
52@@ -90,3 +101,8 @@
53 self.assertThat(retcode, Equals(3))
54 self.assertThat(stderr, Equals("Error: Unable to process request: No JSON object could be decoded\n"))
55
56+ def test_accepts_testability_command_line_argument(self):
57+ retcode, stdout, stderr = run_app_with_args("-help")
58+
59+ self.assertThat(stderr, Contains("-testability"))
60+
61
62=== modified file 'windowmocker/plugins/qt.py'
63--- windowmocker/plugins/qt.py 2013-02-07 16:41:10 +0000
64+++ windowmocker/plugins/qt.py 2013-04-22 22:35:33 +0000
65@@ -22,7 +22,10 @@
66 Name = "Qt4"
67
68 def create_application(self):
69- self.app = QtGui.QApplication(sys.argv[:1])
70+ args = sys.argv[:1]
71+ if "-testability" in sys.argv:
72+ args.append("-testability")
73+ self.app = QtGui.QApplication(args)
74
75 def create_window(self, window_spec):
76 win = QtGui.QMainWindow()

Subscribers

People subscribed via source and target branches

to all changes: