Merge lp:~bzoltan/ubuntu-ui-toolkit/Make_pep8_happy_with_all_the_python_scripts into lp:ubuntu-ui-toolkit/staging
- Make_pep8_happy_with_all_the_python_scripts
- Merge into staging
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Tim Peeters | ||||||||
Approved revision: | 1947 | ||||||||
Merged at revision: | 1947 | ||||||||
Proposed branch: | lp:~bzoltan/ubuntu-ui-toolkit/Make_pep8_happy_with_all_the_python_scripts | ||||||||
Merge into: | lp:ubuntu-ui-toolkit/staging | ||||||||
Diff against target: |
436 lines (+146/-132) 9 files modified
.bazaar/plugins/packaging_sorting.py (+18/-9) documentation/autopilot-helpers/conf.py (+4/-3) tests/autopilot/ubuntuuitoolkit/__init__.py (+36/-38) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py (+31/-32) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py (+2/-1) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+3/-2) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py (+5/-5) tests/autopilot/ubuntuuitoolkit/emulators.py (+35/-36) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_sections.py (+12/-6) |
||||||||
To merge this branch: | bzr merge lp:~bzoltan/ubuntu-ui-toolkit/Make_pep8_happy_with_all_the_python_scripts | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Approve | |
Tim Peeters | Approve | ||
Timo Jyrinki | Approve | ||
Review via email: mp+292462@code.launchpad.net |
Commit message
Make pep8 happy with all the python scripts of the UITK project
Description of the change
Make pep8 happy with all the python scripts of the UITK project
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1947
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1947
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1947
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1947
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Timo Jyrinki (timo-jyrinki) wrote : | # |
Not spotting any errors.
Tim Peeters (tpeeters) wrote : | # |
Thanks for checking and cleaning up.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1947
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1947
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1947
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1947
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file '.bazaar/plugins/packaging_sorting.py' |
2 | --- .bazaar/plugins/packaging_sorting.py 2016-04-12 07:44:08 +0000 |
3 | +++ .bazaar/plugins/packaging_sorting.py 2016-04-21 03:34:38 +0000 |
4 | @@ -20,7 +20,8 @@ |
5 | import os |
6 | import subprocess |
7 | |
8 | -def pre_commit_hook(local, master, old_revno, old_revid, future_revno, |
9 | + |
10 | +def pre_commit_hook(local, master, old_revno, old_revid, future_revno, |
11 | future_revid, tree_delta, future_tree): |
12 | """Ensure packaging has gone through wrap-and-sort command""" |
13 | |
14 | @@ -28,19 +29,27 @@ |
15 | return |
16 | |
17 | if not os.path.exists("/usr/bin/wrap-and-sort"): |
18 | - raise errors.BzrError("Please install 'devscripts' package.") |
19 | - return |
20 | + raise errors.BzrError("Please install 'devscripts' package.") |
21 | + return |
22 | |
23 | - subprocess.call(["cp", "-a", "debian", "debian-packaging-wraptest-temporary"]) |
24 | + subprocess.call(["cp", |
25 | + "-a", |
26 | + "debian", |
27 | + "debian-packaging-wraptest-temporary"]) |
28 | |
29 | subprocess.call(["wrap-and-sort", "-a", "-t"]) |
30 | |
31 | - returncode = subprocess.call(["diff", "-urN", |
32 | - "debian-packaging-wraptest-temporary", "debian"]) |
33 | + returncode = subprocess.call(["diff", |
34 | + "-urN", |
35 | + "debian-packaging-wraptest-temporary", |
36 | + "debian"]) |
37 | if returncode == 1: |
38 | - subprocess.call(["rm", "-rf", "debian-packaging-wraptest-temporary"]) |
39 | - raise errors.BzrError("Please run wrap-and-sort -a -t to clean up packaging.") |
40 | + subprocess.call(["rm", "-rf", "debian-packaging-wraptest-temporary"]) |
41 | + raise errors.BzrError("Please run wrap-and-sort\ |
42 | + -a -t to clean up packaging.") |
43 | |
44 | subprocess.call(["rm", "-rf", "debian-packaging-wraptest-temporary"]) |
45 | |
46 | -branch.Branch.hooks.install_named_hook("pre_commit", pre_commit_hook, "Check packaging sorting") |
47 | +branch.Branch.hooks.install_named_hook("pre_commit", |
48 | + pre_commit_hook, |
49 | + "Check packaging sorting") |
50 | |
51 | === modified file 'documentation/autopilot-helpers/conf.py' |
52 | --- documentation/autopilot-helpers/conf.py 2015-04-21 11:40:00 +0000 |
53 | +++ documentation/autopilot-helpers/conf.py 2016-04-21 03:34:38 +0000 |
54 | @@ -12,17 +12,18 @@ |
55 | # serve to show the default. |
56 | |
57 | import sys |
58 | +import os |
59 | +import ubuntuuitoolkit |
60 | + |
61 | assert sys |
62 | -import os |
63 | assert os |
64 | +assert ubuntuuitoolkit |
65 | |
66 | # If extensions (or modules to document with autodoc) are in another directory, |
67 | # add these directories to sys.path here. If the directory is relative to the |
68 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
69 | sys.path.insert(0, os.path.join(os.path.abspath('../..'), 'tests/autopilot/')) |
70 | |
71 | -import ubuntuuitoolkit |
72 | -assert ubuntuuitoolkit |
73 | |
74 | # -- General configuration ------------------------------------------------ |
75 | |
76 | |
77 | === modified file 'tests/autopilot/ubuntuuitoolkit/__init__.py' |
78 | --- tests/autopilot/ubuntuuitoolkit/__init__.py 2015-12-17 13:29:01 +0000 |
79 | +++ tests/autopilot/ubuntuuitoolkit/__init__.py 2016-04-21 03:34:38 +0000 |
80 | @@ -16,6 +16,42 @@ |
81 | |
82 | """Ubuntu UI Toolkit Autopilot tests and helpers.""" |
83 | |
84 | +from ubuntuuitoolkit import ( |
85 | + base, |
86 | + environment, |
87 | + fixture_setup, |
88 | + tests, |
89 | + ubuntu_scenarios |
90 | +) |
91 | +from ubuntuuitoolkit._custom_proxy_objects import ( |
92 | + ActionBar, |
93 | + AppHeader, |
94 | + check_autopilot_version, |
95 | + CheckBox, |
96 | + get_keyboard, |
97 | + get_pointing_device, |
98 | + Header, |
99 | + Dialog, |
100 | + listitems, |
101 | + UCListItem, |
102 | + MainView, |
103 | + OptionSelector, |
104 | + pickers, |
105 | + popups, |
106 | + QQuickFlickable, |
107 | + QQuickGridView, |
108 | + QQuickListView, |
109 | + Sections, |
110 | + TabBar, |
111 | + Tabs, |
112 | + TextArea, |
113 | + TextField, |
114 | + Toolbar, |
115 | + ToolkitException, |
116 | + UbuntuUIToolkitCustomProxyObjectBase, |
117 | + UbuntuListView11, |
118 | + UbuntuListView, |
119 | +) |
120 | |
121 | __all__ = [ |
122 | 'AppHeader', |
123 | @@ -51,41 +87,3 @@ |
124 | 'UbuntuListView', |
125 | 'UbuntuUIToolkitCustomProxyObjectBase', |
126 | ] |
127 | - |
128 | - |
129 | -from ubuntuuitoolkit import ( |
130 | - base, |
131 | - environment, |
132 | - fixture_setup, |
133 | - tests, |
134 | - ubuntu_scenarios |
135 | -) |
136 | -from ubuntuuitoolkit._custom_proxy_objects import ( |
137 | - ActionBar, |
138 | - AppHeader, |
139 | - check_autopilot_version, |
140 | - CheckBox, |
141 | - get_keyboard, |
142 | - get_pointing_device, |
143 | - Header, |
144 | - Dialog, |
145 | - listitems, |
146 | - UCListItem, |
147 | - MainView, |
148 | - OptionSelector, |
149 | - pickers, |
150 | - popups, |
151 | - QQuickFlickable, |
152 | - QQuickGridView, |
153 | - QQuickListView, |
154 | - Sections, |
155 | - TabBar, |
156 | - Tabs, |
157 | - TextArea, |
158 | - TextField, |
159 | - Toolbar, |
160 | - ToolkitException, |
161 | - UbuntuUIToolkitCustomProxyObjectBase, |
162 | - UbuntuListView11, |
163 | - UbuntuListView, |
164 | -) |
165 | |
166 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py' |
167 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2015-12-17 13:29:01 +0000 |
168 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2016-04-21 03:34:38 +0000 |
169 | @@ -16,38 +16,6 @@ |
170 | |
171 | """Ubuntu UI Toolkit Autopilot custom proxy objects.""" |
172 | |
173 | - |
174 | -__all__ = [ |
175 | - 'AppHeader', |
176 | - 'ActionBar', |
177 | - 'ActionSelectionPopover', |
178 | - 'check_autopilot_version', |
179 | - 'CheckBox', |
180 | - 'get_keyboard', |
181 | - 'get_pointing_device', |
182 | - 'Header', |
183 | - 'Dialog', |
184 | - 'listitems', |
185 | - 'UCListItem', |
186 | - 'MainView', |
187 | - 'OptionSelector', |
188 | - 'pickers', |
189 | - 'popups', |
190 | - 'QQuickFlickable', |
191 | - 'QQuickGridView', |
192 | - 'QQuickListView', |
193 | - 'Sections', |
194 | - 'TabBar', |
195 | - 'Tabs', |
196 | - 'TextArea', |
197 | - 'TextField', |
198 | - 'Toolbar', |
199 | - 'ToolkitException', |
200 | - 'UbuntuListView11', |
201 | - 'UbuntuListView', |
202 | - 'UbuntuUIToolkitCustomProxyObjectBase', |
203 | -] |
204 | - |
205 | from ubuntuuitoolkit._custom_proxy_objects._actionbar import ActionBar |
206 | from ubuntuuitoolkit._custom_proxy_objects._sections import Sections |
207 | from ubuntuuitoolkit._custom_proxy_objects._checkbox import CheckBox |
208 | @@ -94,3 +62,34 @@ |
209 | UbuntuListView11, |
210 | UbuntuListView, |
211 | ) |
212 | + |
213 | +__all__ = [ |
214 | + 'AppHeader', |
215 | + 'ActionBar', |
216 | + 'ActionSelectionPopover', |
217 | + 'check_autopilot_version', |
218 | + 'CheckBox', |
219 | + 'get_keyboard', |
220 | + 'get_pointing_device', |
221 | + 'Header', |
222 | + 'Dialog', |
223 | + 'listitems', |
224 | + 'UCListItem', |
225 | + 'MainView', |
226 | + 'OptionSelector', |
227 | + 'pickers', |
228 | + 'popups', |
229 | + 'QQuickFlickable', |
230 | + 'QQuickGridView', |
231 | + 'QQuickListView', |
232 | + 'Sections', |
233 | + 'TabBar', |
234 | + 'Tabs', |
235 | + 'TextArea', |
236 | + 'TextField', |
237 | + 'Toolbar', |
238 | + 'ToolkitException', |
239 | + 'UbuntuListView11', |
240 | + 'UbuntuListView', |
241 | + 'UbuntuUIToolkitCustomProxyObjectBase', |
242 | +] |
243 | |
244 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py' |
245 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py 2016-02-15 10:28:21 +0000 |
246 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py 2016-04-21 03:34:38 +0000 |
247 | @@ -192,7 +192,8 @@ |
248 | """Return True if malitt-server process is running, False otherwise.""" |
249 | # FIXME: lp#1542224 Use Maliit by default |
250 | if 'UITK_USE_MALIIT' not in os.environ: |
251 | - logger.info("Not going to use Maliit - set UITK_USE_MALIIT to enable it") |
252 | + logger.info("Not going to use Maliit\ |
253 | + - set UITK_USE_MALIIT to enable it") |
254 | return False |
255 | if is_process_running(MALIIT): |
256 | logger.info('Using Maliit for keyboard input') |
257 | |
258 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py' |
259 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-09-30 15:55:35 +0000 |
260 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2016-04-21 03:34:38 +0000 |
261 | @@ -188,8 +188,9 @@ |
262 | 'QQuickItem', objectName='tabsModelProperties') |
263 | if tabs_model_properties.count == 0: |
264 | raise _common.ToolkitException(_NO_TABS_ERROR) |
265 | - next_tab_index = (tabs_model_properties.selectedIndex |
266 | - + 1) % tabs_model_properties.count |
267 | + next_tab_index =\ |
268 | + (tabs_model_properties.selectedIndex + 1)\ |
269 | + % tabs_model_properties.count |
270 | self._switch_to_tab_in_drawer_by_index(next_tab_index) |
271 | |
272 | @autopilot_logging.log_action(logger.info) |
273 | |
274 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py' |
275 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2016-01-20 16:30:36 +0000 |
276 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2016-04-21 03:34:38 +0000 |
277 | @@ -70,16 +70,16 @@ |
278 | direction = 'right' |
279 | |
280 | if direction == 'below': |
281 | - fail_condition = lambda: self.atYEnd |
282 | + def fail_condition(): return self.atYEnd |
283 | swipe_method = self.swipe_to_show_more_below |
284 | elif direction == 'above': |
285 | - fail_condition = lambda: self.atYBeginning |
286 | + def fail_condition(): return self.atYBeginning |
287 | swipe_method = self.swipe_to_show_more_above |
288 | elif direction == 'left': |
289 | - fail_condition = lambda: self.atXBeginning |
290 | + def fail_condition(): return self.atYBeginning |
291 | swipe_method = self.swipe_to_show_more_left |
292 | elif direction == 'right': |
293 | - fail_condition = lambda: self.atXEnd |
294 | + def fail_condition(): return self.atXEnd |
295 | swipe_method = self.swipe_to_show_more_right |
296 | else: |
297 | raise _common.ToolkitException( |
298 | @@ -117,7 +117,7 @@ |
299 | """ |
300 | child = self._is_element_cached(object_name) |
301 | if not child: |
302 | - return False; |
303 | + return False |
304 | |
305 | containers = self._get_containers() |
306 | return self._is_child_visible(child, containers) |
307 | |
308 | === modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py' |
309 | --- tests/autopilot/ubuntuuitoolkit/emulators.py 2014-12-17 11:46:03 +0000 |
310 | +++ tests/autopilot/ubuntuuitoolkit/emulators.py 2016-04-21 03:34:38 +0000 |
311 | @@ -18,6 +18,41 @@ |
312 | |
313 | import logging |
314 | |
315 | +from ubuntuuitoolkit._custom_proxy_objects import ( |
316 | + check_autopilot_version, |
317 | + get_keyboard, |
318 | + get_pointing_device, |
319 | + CheckBox, |
320 | + Header, |
321 | + Dialog, |
322 | + UCListItem, |
323 | + MainView, |
324 | + OptionSelector, |
325 | + QQuickFlickable, |
326 | + QQuickListView, |
327 | + TabBar, |
328 | + Tabs, |
329 | + TextField, |
330 | + Toolbar, |
331 | + ToolkitException as ToolkitEmulatorException, |
332 | + UbuntuUIToolkitCustomProxyObjectBase as UbuntuUIToolkitEmulatorBase, |
333 | +) |
334 | +from ubuntuuitoolkit._custom_proxy_objects.listitems import ( |
335 | + Base, |
336 | + Empty, |
337 | + ItemSelector, |
338 | + MultiValue, |
339 | + SingleControl, |
340 | + SingleValue, |
341 | + Standard, |
342 | + Subtitled |
343 | +) |
344 | +from ubuntuuitoolkit._custom_proxy_objects.popups import ( |
345 | + TextInputPopover, |
346 | + ActionSelectionPopover, |
347 | + ComposerSheet |
348 | +) |
349 | + |
350 | |
351 | logger = logging.getLogger(__name__) |
352 | |
353 | @@ -57,39 +92,3 @@ |
354 | 'ToolkitEmulatorException', |
355 | 'UbuntuUIToolkitEmulatorBase', |
356 | ] |
357 | - |
358 | - |
359 | -from ubuntuuitoolkit._custom_proxy_objects import ( |
360 | - check_autopilot_version, |
361 | - get_keyboard, |
362 | - get_pointing_device, |
363 | - CheckBox, |
364 | - Header, |
365 | - Dialog, |
366 | - UCListItem, |
367 | - MainView, |
368 | - OptionSelector, |
369 | - QQuickFlickable, |
370 | - QQuickListView, |
371 | - TabBar, |
372 | - Tabs, |
373 | - TextField, |
374 | - Toolbar, |
375 | - ToolkitException as ToolkitEmulatorException, |
376 | - UbuntuUIToolkitCustomProxyObjectBase as UbuntuUIToolkitEmulatorBase, |
377 | -) |
378 | -from ubuntuuitoolkit._custom_proxy_objects.listitems import ( |
379 | - Base, |
380 | - Empty, |
381 | - ItemSelector, |
382 | - MultiValue, |
383 | - SingleControl, |
384 | - SingleValue, |
385 | - Standard, |
386 | - Subtitled |
387 | -) |
388 | -from ubuntuuitoolkit._custom_proxy_objects.popups import ( |
389 | - TextInputPopover, |
390 | - ActionSelectionPopover, |
391 | - ComposerSheet |
392 | -) |
393 | |
394 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_sections.py' |
395 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_sections.py 2016-01-21 16:01:41 +0000 |
396 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_sections.py 2016-04-21 03:34:38 +0000 |
397 | @@ -29,11 +29,14 @@ |
398 | def setUp(self): |
399 | super().setUp() |
400 | self.sections = self.app.select_single(objectName='sections') |
401 | - self.scrollingSections = self.app.select_single(objectName='scrolling_sections') |
402 | + self.scrollingSections =\ |
403 | + self.app.select_single(objectName='scrolling_sections') |
404 | self.label = self.app.select_single(objectName='label') |
405 | - self.scrollingLabel = self.app.select_single(objectName='scrolling_label') |
406 | + self.scrollingLabel =\ |
407 | + self.app.select_single(objectName='scrolling_label') |
408 | self.assertEqual(self.label.text, 'Section 0 is selected.') |
409 | - self.assertEqual(self.scrollingLabel.text, 'Scrollable section 0 is selected.') |
410 | + self.assertEqual(self.scrollingLabel.text, |
411 | + 'Scrollable section 0 is selected.') |
412 | |
413 | def test_custom_proxy_object(self): |
414 | self.assertIsInstance(self.sections, ubuntuuitoolkit.Sections) |
415 | @@ -47,15 +50,18 @@ |
416 | |
417 | def test_click_visible_scrolling_section_button(self): |
418 | self.scrollingSections.click_section_button(2) |
419 | - self.assertEqual(self.scrollingLabel.text, 'Scrollable section 2 is selected.') |
420 | + self.assertEqual(self.scrollingLabel.text, |
421 | + 'Scrollable section 2 is selected.') |
422 | |
423 | def test_scroll_and_click_section_button(self): |
424 | # scroll forward and click: |
425 | self.scrollingSections.click_section_button(15) |
426 | - self.assertEqual(self.scrollingLabel.text, 'Scrollable section 15 is selected.') |
427 | + self.assertEqual(self.scrollingLabel.text, |
428 | + 'Scrollable section 15 is selected.') |
429 | # scroll back and click: |
430 | self.scrollingSections.click_section_button(1) |
431 | - self.assertEqual(self.scrollingLabel.text, 'Scrollable section 1 is selected.') |
432 | + self.assertEqual(self.scrollingLabel.text, |
433 | + 'Scrollable section 1 is selected.') |
434 | |
435 | def test_click_unexisting_section_button(self): |
436 | error = self.assertRaises( |
PASSED: Continuous integration, rev:1947 /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 714/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/2765/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 714/rebuild
https:/