Merge lp:~sbaldassin/autopilot/fix_1671155 into lp:autopilot
- fix_1671155
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Richard Huddie |
Approved revision: | 600 |
Merged at revision: | 593 |
Proposed branch: | lp:~sbaldassin/autopilot/fix_1671155 |
Merge into: | lp:autopilot |
Diff against target: |
129 lines (+61/-6) 4 files modified
autopilot/display/__init__.py (+1/-1) autopilot/input/__init__.py (+12/-4) autopilot/tests/unit/test_display.py (+33/-0) autopilot/tests/unit/test_input.py (+15/-1) |
To merge this branch: | bzr merge lp:~sbaldassin/autopilot/fix_1671155 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Richard Huddie (community) | Approve | ||
platform-qa-bot | continuous-integration | Approve | |
Heber Parrucci (community) | Approve | ||
Review via email: mp+319367@code.launchpad.net |
Commit message
Restoring backends order
Description of the change
Restoring the backends order so that existing applications running autopilot test cases in u7 can still work
Fixes: https:/
platform-qa-bot (platform-qa-bot) wrote : | # |
Richard Huddie (rhuddie) wrote : | # |
Confirm the fix is working. But what I have found is that when trying to create a keyboard on unity8, there is about 10 second delay in creating it whilst there is a check to try and get proxy object for maliit process for OSK. If OSK is below UInput in list this doesn't happen. But the OSK would then only be selected if specifically selected by preferred_backend parameter. Perhaps best fix would be to remove the timeout for getting the maliit proxy object so it would fail immediately?
You can reproduce this by doing following on unity8 with this fix installed:
$ python3
>>> from autopilot.input import Keyboard
>>> k = Keyboard().create()
Santiago Baldassin (sbaldassin) wrote : | # |
Good catch Richard. I haven't been able to reproduce it though. I've added more logging to autopilot and this is what I get
>>> from autopilot.input import Keyboard
>>>
>>>
>>> k = Keyboard().create()
11:41:56.823493: Creating X11
11:41:56.914873: Creating OSK
11:41:56.988823: Creating UInput
The risk that I see is the same I've been pointing out when we decided to change the list order, there are people out there using autopilot and if we changed the default list order, we might impact them.
If someone, either ust, the web browser app or anyone else wants to avoid any failed attempt, they can use the preferred_backend option as you pointed out. In our case...
>>> k = Keyboard(
11:44:14.934115: Creating UInput
Richard Huddie (rhuddie) wrote : | # |
That is strange, you're on unity8? This is the output I get with similar logging, which shows the big gap between OSK and UInput:
>>> from autopilot.input import Keyboard
>>> k = Keyboard().create()
12:15:45.329685 Creating X11
12:15:45.331326 Creating OSK
12:15:56.319388 Creating UInput
>>> type(k)
<class 'autopilot.
- 594. By Santiago Baldassin
-
Adding unit tests
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:594
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:594
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:594
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
- 595. By Santiago Baldassin
-
Fixing flake8
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:595
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
- 596. By Santiago Baldassin
-
Using unittest.mock.patch
Richard Huddie (rhuddie) wrote : | # |
The 10 sec delay when creating the keyboard is triggered if you have the ubuntu-
So we would either need to move osk to bottom of list, in which case you would only get it if you asked for it with preferred_backend parameter, or to remove the timeout period on getting the maliit proxy object to make it fail with no delay.
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:596
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
- 597. By Santiago Baldassin
-
Fixing flake8 errors
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:597
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
- 598. By Santiago Baldassin
-
Adding workaround to avoid delays
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:598
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Richard Huddie (rhuddie) wrote : | # |
Comment below.
- 599. By Santiago Baldassin
-
Minor change
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:599
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Richard Huddie (rhuddie) wrote : | # |
Minor fix needed
- 600. By Santiago Baldassin
-
Minor fix
platform-qa-bot (platform-qa-bot) wrote : | # |
PASSED: Continuous integration, rev:600
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'autopilot/display/__init__.py' | |||
2 | --- autopilot/display/__init__.py 2016-11-22 13:12:14 +0000 | |||
3 | +++ autopilot/display/__init__.py 2017-03-13 14:06:25 +0000 | |||
4 | @@ -107,8 +107,8 @@ | |||
5 | 107 | return Display() | 107 | return Display() |
6 | 108 | 108 | ||
7 | 109 | backends = OrderedDict() | 109 | backends = OrderedDict() |
8 | 110 | backends['X11'] = get_x11_display | ||
9 | 110 | backends['UPA'] = get_upa_display | 111 | backends['UPA'] = get_upa_display |
10 | 111 | backends['X11'] = get_x11_display | ||
11 | 112 | return _pick_backend(backends, preferred_backend) | 112 | return _pick_backend(backends, preferred_backend) |
12 | 113 | 113 | ||
13 | 114 | class BlacklistedDriverError(RuntimeError): | 114 | class BlacklistedDriverError(RuntimeError): |
14 | 115 | 115 | ||
15 | === modified file 'autopilot/input/__init__.py' | |||
16 | --- autopilot/input/__init__.py 2016-11-22 12:42:52 +0000 | |||
17 | +++ autopilot/input/__init__.py 2017-03-13 14:06:25 +0000 | |||
18 | @@ -57,6 +57,9 @@ | |||
19 | 57 | 57 | ||
20 | 58 | from collections import OrderedDict | 58 | from collections import OrderedDict |
21 | 59 | from contextlib import contextmanager | 59 | from contextlib import contextmanager |
22 | 60 | |||
23 | 61 | import psutil | ||
24 | 62 | |||
25 | 60 | from autopilot.input._common import get_center_point | 63 | from autopilot.input._common import get_center_point |
26 | 61 | from autopilot.utilities import _pick_backend, CleanupRegistered | 64 | from autopilot.utilities import _pick_backend, CleanupRegistered |
27 | 62 | 65 | ||
28 | @@ -119,16 +122,21 @@ | |||
29 | 119 | 122 | ||
30 | 120 | def get_osk_kb(): | 123 | def get_osk_kb(): |
31 | 121 | try: | 124 | try: |
34 | 122 | from autopilot.input._osk import Keyboard | 125 | maliit = [p for p in |
35 | 123 | return Keyboard() | 126 | psutil.process_iter() if p.name() == 'maliit-server'] |
36 | 127 | if maliit: | ||
37 | 128 | from autopilot.input._osk import Keyboard | ||
38 | 129 | return Keyboard() | ||
39 | 130 | else: | ||
40 | 131 | raise RuntimeError('maliit-server is not running') | ||
41 | 124 | except ImportError as e: | 132 | except ImportError as e: |
42 | 125 | e.args += ("Unable to import the OSK backend",) | 133 | e.args += ("Unable to import the OSK backend",) |
43 | 126 | raise | 134 | raise |
44 | 127 | 135 | ||
45 | 128 | backends = OrderedDict() | 136 | backends = OrderedDict() |
46 | 137 | backends['X11'] = get_x11_kb | ||
47 | 138 | backends['OSK'] = get_osk_kb | ||
48 | 129 | backends['UInput'] = get_uinput_kb | 139 | backends['UInput'] = get_uinput_kb |
49 | 130 | backends['OSK'] = get_osk_kb | ||
50 | 131 | backends['X11'] = get_x11_kb | ||
51 | 132 | return _pick_backend(backends, preferred_backend) | 140 | return _pick_backend(backends, preferred_backend) |
52 | 133 | 141 | ||
53 | 134 | @contextmanager | 142 | @contextmanager |
54 | 135 | 143 | ||
55 | === added file 'autopilot/tests/unit/test_display.py' | |||
56 | --- autopilot/tests/unit/test_display.py 1970-01-01 00:00:00 +0000 | |||
57 | +++ autopilot/tests/unit/test_display.py 2017-03-13 14:06:25 +0000 | |||
58 | @@ -0,0 +1,33 @@ | |||
59 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
60 | 2 | # | ||
61 | 3 | # Autopilot Functional Test Tool | ||
62 | 4 | # Copyright (C) 2016 Canonical | ||
63 | 5 | # | ||
64 | 6 | # This program is free software: you can redistribute it and/or modify | ||
65 | 7 | # it under the terms of the GNU General Public License as published by | ||
66 | 8 | # the Free Software Foundation, either version 3 of the License, or | ||
67 | 9 | # (at your option) any later version. | ||
68 | 10 | # | ||
69 | 11 | # This program is distributed in the hope that it will be useful, | ||
70 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
71 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
72 | 14 | # GNU General Public License for more details. | ||
73 | 15 | # | ||
74 | 16 | # You should have received a copy of the GNU General Public License | ||
75 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
76 | 18 | # | ||
77 | 19 | import unittest | ||
78 | 20 | from unittest.mock import patch | ||
79 | 21 | from autopilot.display import Display | ||
80 | 22 | |||
81 | 23 | |||
82 | 24 | class DisplayTestCase(unittest.TestCase): | ||
83 | 25 | |||
84 | 26 | @patch('autopilot.display._pick_backend') | ||
85 | 27 | def test_input_backends_default_order(self, pick_backend): | ||
86 | 28 | d = Display() | ||
87 | 29 | d.create() | ||
88 | 30 | |||
89 | 31 | backends = list(pick_backend.call_args[0][0].items()) | ||
90 | 32 | self.assertTrue(backends[0][0] == 'X11') | ||
91 | 33 | self.assertTrue(backends[1][0] == 'UPA') | ||
92 | 0 | 34 | ||
93 | === modified file 'autopilot/tests/unit/test_input.py' | |||
94 | --- autopilot/tests/unit/test_input.py 2016-06-24 11:13:25 +0000 | |||
95 | +++ autopilot/tests/unit/test_input.py 2017-03-13 14:06:25 +0000 | |||
96 | @@ -18,6 +18,7 @@ | |||
97 | 18 | # | 18 | # |
98 | 19 | 19 | ||
99 | 20 | import logging | 20 | import logging |
100 | 21 | import unittest | ||
101 | 21 | 22 | ||
102 | 22 | import testscenarios | 23 | import testscenarios |
103 | 23 | from evdev import ecodes, uinput | 24 | from evdev import ecodes, uinput |
104 | @@ -30,7 +31,7 @@ | |||
105 | 30 | tests, | 31 | tests, |
106 | 31 | utilities | 32 | utilities |
107 | 32 | ) | 33 | ) |
109 | 33 | from autopilot.input import _uinput, get_center_point | 34 | from autopilot.input import _uinput, get_center_point, Keyboard |
110 | 34 | 35 | ||
111 | 35 | 36 | ||
112 | 36 | class Empty(object): | 37 | class Empty(object): |
113 | @@ -1101,3 +1102,16 @@ | |||
114 | 1101 | self.assert_power_button_press_release_emitted_write_and_sync( | 1102 | self.assert_power_button_press_release_emitted_write_and_sync( |
115 | 1102 | device._device.mock_calls | 1103 | device._device.mock_calls |
116 | 1103 | ) | 1104 | ) |
117 | 1105 | |||
118 | 1106 | |||
119 | 1107 | class KeyboardTestCase(unittest.TestCase): | ||
120 | 1108 | |||
121 | 1109 | @patch('autopilot.input._pick_backend') | ||
122 | 1110 | def test_input_backends_default_order(self, pick_backend): | ||
123 | 1111 | k = Keyboard() | ||
124 | 1112 | k.create() | ||
125 | 1113 | |||
126 | 1114 | backends = list(pick_backend.call_args[0][0].items()) | ||
127 | 1115 | self.assertTrue(backends[0][0] == 'X11') | ||
128 | 1116 | self.assertTrue(backends[1][0] == 'OSK') | ||
129 | 1117 | self.assertTrue(backends[2][0] == 'UInput') |
PASSED: Continuous integration, rev:593 /platform- qa-jenkins. ubuntu. com/job/ autopilot- ci/168/ /platform- qa-jenkins. ubuntu. com/job/ build-xenial- amd64-package/ 549 /platform- qa-jenkins. ubuntu. com/job/ build-xenial- amd64-package/ 549/artifact/ work/output/ *zip*/output. zip /platform- qa-jenkins. ubuntu. com/job/ build-xenial- i386-package/ 546 /platform- qa-jenkins. ubuntu. com/job/ build-xenial- i386-package/ 546/artifact/ work/output/ *zip*/output. zip /platform- qa-jenkins. ubuntu. com/job/ generic- update- mp/2083/ console
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
None: https:/
Click here to trigger a rebuild: /platform- qa-jenkins. ubuntu. com/job/ autopilot- ci/168/ rebuild
https:/