Merge lp:~elopio/unity8/fix1335548-click_scope_item into lp:unity8

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~elopio/unity8/fix1335548-click_scope_item
Merge into: lp:unity8
Diff against target: 602 lines (+151/-76)
11 files modified
.bazaar/plugins/makecheck_unity_phablet.py (+17/-9)
tests/autopilot/unity8/process_helpers.py (+4/-3)
tests/autopilot/unity8/shell/emulators/dash.py (+14/-4)
tests/autopilot/unity8/shell/tests/__init__.py (+1/-2)
tests/autopilot/unity8/shell/tests/disabled_test_hud.py (+44/-13)
tests/autopilot/unity8/shell/tests/test_emulators.py (+0/-2)
tests/autopilot/unity8/shell/tests/test_lock_screen.py (+4/-5)
tests/autopilot/unity8/shell/tests/test_notifications.py (+15/-10)
tests/autopilot/unity8/shell/tests/test_system_integration.py (+10/-5)
tests/autopilot/unity8/shell/tests/test_upstart.py (+20/-11)
tests/whitespace/check_whitespace.py (+22/-12)
To merge this branch: bzr merge lp:~elopio/unity8/fix1335548-click_scope_item
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+224922@code.launchpad.net

This proposal has been superseded by a proposal from 2014-06-29.

Commit message

Added an autopilot helper to click a scope item.

Description of the change

This is already tested on the test for opening a preview. No need to duplicate that adding a new test.

To post a comment you must log in.
980. By Leo Arias

Merged with trunk.

981. By Leo Arias

Merged with trunk.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bazaar/plugins/makecheck_unity_phablet.py'
2--- .bazaar/plugins/makecheck_unity_phablet.py 2014-03-24 16:23:37 +0000
3+++ .bazaar/plugins/makecheck_unity_phablet.py 2014-06-29 05:34:12 +0000
4@@ -1,5 +1,5 @@
5 #!/usr/bin/python
6-# Copyright 2013 Canonical Ltd.
7+# Copyright 2013, 2014 Canonical Ltd.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU Lesser General Public License as published by
11@@ -13,11 +13,15 @@
12 # You should have received a copy of the GNU Lesser General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
15-import os, subprocess
16-from bzrlib import branch, errors
17-from bzrlib.urlutils import dirname, local_path_from_url
18-
19-def execute_makecheck(local_branch, master_branch, old_revision_number, old_revision_id, future_revision_number, future_revision_id, tree_delta, future_tree):
20+import os
21+import subprocess
22+from bzrlib import branch
23+from bzrlib.urlutils import local_path_from_url
24+
25+
26+def execute_makecheck(
27+ local_branch, master_branch, old_revision_number, old_revision_id,
28+ future_revision_number, future_revision_id, tree_delta, future_tree):
29 if not master_branch.basis_tree().has_filename("qml/Shell.qml"):
30 return
31
32@@ -27,7 +31,9 @@
33 os.environ['CTEST_OUTPUT_ON_FAILURE'] = "1"
34 if (subprocess.call("make -C builddir test", shell=True) != 0):
35
36- print("\n\n*** Warning ***\n\nBasic tests failed. This commit will not pass continuous integration.")
37+ print("\n\n*** Warning ***\n\n"
38+ "Basic tests failed. This commit will not pass continuous "
39+ "integration.")
40
41 branch = local_branch or master_branch
42 revision = branch.repository.get_revision(future_revision_id)
43@@ -36,8 +42,10 @@
44 msg_file.close()
45
46 print("\n\nSaved commit message to $SRC_DIR/message.txt.")
47- print("You can uncommit this revision, fix the tests and reuse your message running:\n\nbzr commit -F message.txt\n\n")
48+ print("You can uncommit this revision, fix the tests and reuse your "
49+ "message running:\n\nbzr commit -F message.txt\n\n")
50 elif os.path.isfile("message.txt"):
51 os.remove("message.txt")
52
53-branch.Branch.hooks.install_named_hook('pre_commit', execute_makecheck, 'make check pre-commit')
54+branch.Branch.hooks.install_named_hook(
55+ 'pre_commit', execute_makecheck, 'make check pre-commit')
56
57=== modified file 'tests/autopilot/unity8/process_helpers.py'
58--- tests/autopilot/unity8/process_helpers.py 2014-06-11 15:36:51 +0000
59+++ tests/autopilot/unity8/process_helpers.py 2014-06-29 05:34:12 +0000
60@@ -75,7 +75,7 @@
61 main_window_emulator.QQuickView)
62
63 greeter = main_window.get_greeter()
64- if greeter.created == False:
65+ if greeter.created is False:
66 raise RuntimeWarning("Greeter appears to be already unlocked.")
67
68 # Because of potential input jerkiness under heavy load,
69@@ -98,7 +98,8 @@
70
71 def lock_unity(unity_proxy_obj=None):
72 """Helper function that attempts to lock the unity greeter."""
73- import evdev, time
74+ import evdev
75+ import time
76 uinput = evdev.UInput(name='unity8-autopilot-power-button',
77 devnode='/dev/autopilot-uinput')
78 # One press and release to turn screen off (locking unity)
79@@ -172,7 +173,7 @@
80
81 def _get_unity_pid():
82 status = _get_unity_status()
83- if not "start/" in status:
84+ if "start/" not in status:
85 raise CannotAccessUnity("Unity is not in the running state.")
86 return int(status.split()[-1])
87
88
89=== modified file 'tests/autopilot/unity8/shell/emulators/dash.py'
90--- tests/autopilot/unity8/shell/emulators/dash.py 2014-05-05 14:03:40 +0000
91+++ tests/autopilot/unity8/shell/emulators/dash.py 2014-06-29 05:34:12 +0000
92@@ -156,22 +156,32 @@
93 """Open the preview of an application.
94
95 :parameter category: The name of the category where the application is.
96- :app_name: The name of the application.
97+ :parameter app_name: The name of the application.
98 :return: The opened preview.
99
100 """
101- category_element = self._get_category_element(category)
102- icon = category_element.select_single('AbstractButton', title=app_name)
103 # FIXME some categories need a long press in order to see the preview.
104 # Some categories do not show previews, like recent apps.
105 # --elopio - 2014-1-14
106- self.pointing_device.click_object(icon)
107+ self.click_scope_item(category, app_name)
108 preview_list = self.get_root_instance().wait_select_single(
109 'PreviewListView', objectName='dashContentPreviewList')
110 preview_list.x.wait_for(0)
111 return preview_list.select_single(
112 Preview, objectName='preview{}'.format(preview_list.currentIndex))
113
114+ @autopilot_logging.log_action(logger.debug)
115+ def click_scope_item(self, category, title):
116+ """Click an item from the scope.
117+
118+ :parameter category: The name of the category where the item is.
119+ :parameter title: The title of the item.
120+
121+ """
122+ category_element = self._get_category_element(category)
123+ icon = category_element.select_single('AbstractButton', title=title)
124+ self.pointing_device.click_object(icon)
125+
126 def _get_category_element(self, category):
127 try:
128 return self.wait_select_single(
129
130=== modified file 'tests/autopilot/unity8/shell/tests/__init__.py'
131--- tests/autopilot/unity8/shell/tests/__init__.py 2014-06-11 15:36:51 +0000
132+++ tests/autopilot/unity8/shell/tests/__init__.py 2014-06-29 05:34:12 +0000
133@@ -142,12 +142,11 @@
134 self._data_dirs_mock_enabled = True
135 self._environment = {}
136
137- #### FIXME: This is a work around re: lp:1238417 ####
138+ # FIXME: This is a work around re: lp:1238417
139 if model() != "Desktop":
140 from autopilot.input import _uinput
141 _uinput._touch_device = _uinput.create_touch_device()
142 self.addCleanup(_uinput._touch_device.close)
143- ####
144
145 self.touch = Touch.create()
146 self._setup_display_details()
147
148=== modified file 'tests/autopilot/unity8/shell/tests/disabled_test_hud.py'
149--- tests/autopilot/unity8/shell/tests/disabled_test_hud.py 2014-06-11 15:36:51 +0000
150+++ tests/autopilot/unity8/shell/tests/disabled_test_hud.py 2014-06-29 05:34:12 +0000
151@@ -20,12 +20,13 @@
152 from __future__ import absolute_import
153
154 from unity8.process_helpers import unlock_unity
155-from unity8.shell import with_lightdm_mock, DragMixin
156+from unity8.shell import DragMixin
157 from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
158
159 from testtools.matchers import Equals
160 from autopilot.matchers import Eventually
161
162+
163 class TestHud(UnityTestCase, DragMixin):
164
165 """Tests the Shell HUD."""
166@@ -33,10 +34,14 @@
167 scenarios = _get_device_emulation_scenarios()
168
169 def test_show_hud_button_appears(self):
170- """Swiping up while an app is active must show the 'show hud' button, following some behaviours.
171+ """Swiping up while an app is active must show the 'show hud' button.
172+
173+ It should follow some behaviours.
174 The button must disappear not opening the HUD when releasing the
175- mouse again somewhere on the screen except on the button itself following a timeout.
176- The button must disappear when touching somewhere on the screen except the button itself.
177+ mouse again somewhere on the screen except on the button itself
178+ following a timeout.
179+ The button must disappear when touching somewhere on the screen
180+ except the button itself.
181
182 """
183 unity_proxy = self.launch_unity()
184@@ -55,29 +60,47 @@
185
186 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
187 self.addCleanup(self._maybe_release_finger)
188- self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5)
189+ self._drag(
190+ swipe_coords.start_x,
191+ swipe_coords.start_y,
192+ swipe_coords.start_x,
193+ swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5)
194 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.5)))
195- self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(initialBottomMargin)))
196- self._drag(swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5, swipe_coords.end_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - int(edge_drag_area.commitDistance) - 5)
197+ self.assertThat(
198+ hud_show_button.bottomMargin,
199+ Eventually(Equals(initialBottomMargin)))
200+ self._drag(
201+ swipe_coords.start_x,
202+ swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5,
203+ swipe_coords.end_x,
204+ swipe_coords.start_y - int(edge_drag_area.distanceThreshold) -
205+ int(edge_drag_area.commitDistance) - 5)
206 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
207 self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(0.0)))
208- self.touch.release();
209+ self.touch.release()
210 self.assertThat(hud.shown, Equals(False))
211 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))
212
213 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
214- self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height))
215+ self._drag(
216+ swipe_coords.start_x,
217+ swipe_coords.start_y,
218+ swipe_coords.start_x,
219+ swipe_coords.end_y - int(hud_show_button.height))
220 self.assertThat(hud.shown, Equals(False))
221 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
222 self.touch.release()
223 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
224- self.touch.tap(swipe_coords.end_x, swipe_coords.end_y - int(hud_show_button.height))
225+ self.touch.tap(
226+ swipe_coords.end_x,
227+ swipe_coords.end_y - int(hud_show_button.height))
228 self.assertThat(hud.shown, Equals(False))
229 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))
230
231 def test_show_hud_appears(self):
232 """Releasing the touch on the 'show hud' button must display the hud.
233- Test that the hud button stays on screen and tapping it opens the hud.
234+ Test that the hud button stays on screen and tapping it opens the
235+ hud.
236
237 """
238 unity_proxy = self.launch_unity()
239@@ -94,7 +117,11 @@
240
241 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
242 self.addCleanup(self._maybe_release_finger)
243- self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y)
244+ self._drag(
245+ swipe_coords.start_x,
246+ swipe_coords.start_y,
247+ swipe_coords.start_x,
248+ swipe_coords.end_y)
249 self.assertThat(hud.shown, Eventually(Equals(False)))
250 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
251 self.touch.release()
252@@ -105,7 +132,11 @@
253 self.assertThat(hud.shown, Eventually(Equals(False)))
254
255 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
256- self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height))
257+ self._drag(
258+ swipe_coords.start_x,
259+ swipe_coords.start_y,
260+ swipe_coords.start_x,
261+ swipe_coords.end_y - int(hud_show_button.height))
262 self.assertThat(hud.shown, Equals(False))
263 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
264 self.touch.release()
265
266=== modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py'
267--- tests/autopilot/unity8/shell/tests/test_emulators.py 2014-06-11 15:36:51 +0000
268+++ tests/autopilot/unity8/shell/tests/test_emulators.py 2014-06-29 05:34:12 +0000
269@@ -32,8 +32,6 @@
270 except ImportError:
271 import mock
272
273-from testtools.matchers import Contains, HasLength
274-
275 from unity8 import process_helpers
276 from unity8.shell import emulators, fixture_setup, tests
277 from unity8.shell.emulators import dash as dash_emulators
278
279=== modified file 'tests/autopilot/unity8/shell/tests/test_lock_screen.py'
280--- tests/autopilot/unity8/shell/tests/test_lock_screen.py 2014-06-11 15:36:51 +0000
281+++ tests/autopilot/unity8/shell/tests/test_lock_screen.py 2014-06-29 05:34:12 +0000
282@@ -1,7 +1,7 @@
283 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
284 #
285 # Unity Autopilot Test Suite
286-# Copyright (C) 2012-2013 Canonical
287+# Copyright (C) 2012, 2013, 2014 Canonical
288 #
289 # This program is free software: you can redistribute it and/or modify
290 # it under the terms of the GNU General Public License as published by
291@@ -25,9 +25,7 @@
292 from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
293
294 from autopilot.matchers import Eventually
295-from autopilot.platform import model
296 import sys
297-from testtools import skipUnless
298 from testtools.matchers import Equals
299 import logging
300
301@@ -133,7 +131,7 @@
302 if not isinstance(code, basestring):
303 raise TypeError(
304 "'code' parameter must be a string, not %r."
305- % type(passphrase)
306+ % type(code)
307 )
308 for num in code:
309 if not num.isdigit():
310@@ -190,7 +188,8 @@
311 current_text = prompt.text
312 self.keyboard.type(character)
313 try:
314- self.assertThat(prompt.text, Eventually(Equals(current_text + character)))
315+ self.assertThat(
316+ prompt.text, Eventually(Equals(current_text + character)))
317 except AssertionError:
318 if retries > 0:
319 self._type_character(character, prompt, retries-1)
320
321=== modified file 'tests/autopilot/unity8/shell/tests/test_notifications.py'
322--- tests/autopilot/unity8/shell/tests/test_notifications.py 2014-06-11 15:36:51 +0000
323+++ tests/autopilot/unity8/shell/tests/test_notifications.py 2014-06-29 05:34:12 +0000
324@@ -211,8 +211,8 @@
325 self.touch.tap_object(notification.select_single(objectName="button4"))
326 self.assert_notification_action_id_was_called("action_decline_4")
327
328- def test_modal_sd_without_greeter (self):
329- """A snap-decision on a phone should block input to shell beneath it when there's no greeter."""
330+ def test_modal_sd_without_greeter(self):
331+ """Snap-decision should block input to shell without greeter."""
332 unity_proxy = self.launch_unity()
333 unlock_unity(unity_proxy)
334
335@@ -238,7 +238,8 @@
336 hints
337 )
338
339- # verify that we cannot reveal the launcher (no longer interact with the shell)
340+ # verify that we cannot reveal the launcher (no longer interact with
341+ # the shell)
342 time.sleep(1)
343 self.main_window.show_dash_swiping()
344 launcher = self.main_window.get_launcher()
345@@ -249,13 +250,14 @@
346 get_notification = lambda: notify_list.wait_select_single(
347 'Notification', objectName='notification1')
348 notification = get_notification()
349- self._assert_notification(notification, summary, body, True, False, 1.0)
350+ self._assert_notification(
351+ notification, summary, body, True, False, 1.0)
352 self.touch.tap_object(notification.select_single(objectName="button0"))
353 self.assert_notification_action_id_was_called("action_accept")
354
355- def test_modal_sd_with_greeter (self):
356- """A snap-decision on a phone should not block input to the greeter beneath it."""
357- unity_proxy = self.launch_unity()
358+ def test_modal_sd_with_greeter(self):
359+ """A snap-decision should not block input to the greeter beneath it."""
360+ self.launch_unity()
361
362 summary = "Incoming file"
363 body = "Frank would like to send you the file: essay.pdf"
364@@ -290,7 +292,8 @@
365 get_notification = lambda: notify_list.wait_select_single(
366 'Notification', objectName='notification1')
367 notification = get_notification()
368- self._assert_notification(notification, summary, body, True, False, 1.0)
369+ self._assert_notification(
370+ notification, summary, body, True, False, 1.0)
371 self.touch.tap_object(notification.select_single(objectName="button0"))
372 self.assert_notification_action_id_was_called("action_accept")
373
374@@ -663,7 +666,8 @@
375 icon_path = self._get_icon_path('avatars/amanda.png')
376 notification.update(summary, body, icon_path)
377 notification.show()
378- self._assert_notification(get_notification(), summary, body, True, False, 1.0)
379+ self._assert_notification(
380+ get_notification(), summary, body, True, False, 1.0)
381
382 def test_update_notification_layout_change(self):
383 """Notification must allow updating its contents and layout while
384@@ -710,7 +714,8 @@
385 notification.show()
386
387 self.assertThat(get_notification, Eventually(NotEquals(None)))
388- self._assert_notification(get_notification(), summary, body, False, False, 1.0)
389+ self._assert_notification(
390+ get_notification(), summary, body, False, False, 1.0)
391
392 def test_append_hint(self):
393 """Notification has to accumulate body-text using append-hint."""
394
395=== modified file 'tests/autopilot/unity8/shell/tests/test_system_integration.py'
396--- tests/autopilot/unity8/shell/tests/test_system_integration.py 2014-04-09 17:31:15 +0000
397+++ tests/autopilot/unity8/shell/tests/test_system_integration.py 2014-06-29 05:34:12 +0000
398@@ -23,19 +23,24 @@
399 import unittest
400
401 from autopilot import platform
402-from unity8.shell.emulators import UnityEmulatorBase
403 from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
404
405-from testtools.matchers._basic import Equals
406
407 class SystemIntegrationTests(UnityTestCase):
408
409 scenarios = _get_device_emulation_scenarios()
410
411- @unittest.skipIf(platform.model() == "Desktop", "Test is broken on otto, see bug 1281634.")
412+ @unittest.skipIf(
413+ platform.model() == "Desktop",
414+ "Test is broken on otto, see bug 1281634.")
415 def test_networkmanager_integration(self):
416 self.launch_unity()
417
418 # invoke policykit to check permissions
419- pid = subprocess.check_output(["pidof", "-s", "unity8"], universal_newlines=True)
420- subprocess.check_call("pkcheck --action-id org.freedesktop.NetworkManager.enable-disable-network --process " + pid, shell=True)
421+ pid = subprocess.check_output(
422+ ["pidof", "-s", "unity8"], universal_newlines=True)
423+ subprocess.check_call(
424+ "pkcheck --action-id "
425+ "org.freedesktop.NetworkManager.enable-disable-network "
426+ "--process " + pid,
427+ shell=True)
428
429=== modified file 'tests/autopilot/unity8/shell/tests/test_upstart.py'
430--- tests/autopilot/unity8/shell/tests/test_upstart.py 2014-05-01 14:25:18 +0000
431+++ tests/autopilot/unity8/shell/tests/test_upstart.py 2014-06-29 05:34:12 +0000
432@@ -1,7 +1,7 @@
433 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
434 #
435 # Unity Autopilot Test Suite
436-# Copyright (C) 2013 Canonical
437+# Copyright (C) 2013, 2014 Canonical
438 #
439 # This program is free software: you can redistribute it and/or modify
440 # it under the terms of the GNU General Public License as published by
441@@ -42,19 +42,24 @@
442 if sys.version_info < (3,):
443 range = xrange
444
445+
446 class UpstartIntegrationTests(UnityTestCase):
447
448 scenarios = _get_device_emulation_scenarios()
449
450 def _get_status(self):
451- pid, status = os.waitpid(self.process.pid, os.WUNTRACED | os.WCONTINUED | os.WNOHANG)
452- logger.debug("Got status: {0}; stopped: {1}; continued: {2}"\
453- .format(status, os.WIFSTOPPED(status), os.WIFCONTINUED(status)))
454+ pid, status = os.waitpid(
455+ self.process.pid, os.WUNTRACED | os.WCONTINUED | os.WNOHANG)
456+ logger.debug(
457+ "Got status: {0}; stopped: {1}; continued: {2}".format(
458+ status, os.WIFSTOPPED(status), os.WIFCONTINUED(status)))
459 return status
460
461 def _launch_unity(self):
462 self.patch_environment("QT_LOAD_TESTABILITY", "1")
463- self.process = subprocess.Popen([get_binary_path()] + self.unity_geometry_args)
464+ self.process = subprocess.Popen(
465+ [get_binary_path()] + self.unity_geometry_args)
466+
467 def ensure_stopped():
468 self.process.terminate()
469 for i in range(10):
470@@ -76,10 +81,10 @@
471 self.addCleanup(ensure_stopped)
472
473 def _set_proxy(self):
474- super(UpstartIntegrationTests, self)._set_proxy(get_proxy_object_for_existing_process(
475- pid=self.process.pid,
476- emulator_base=UnityEmulatorBase,
477- ))
478+ super(UpstartIntegrationTests, self)._set_proxy(
479+ get_proxy_object_for_existing_process(
480+ pid=self.process.pid,
481+ emulator_base=UnityEmulatorBase,))
482
483 def test_no_sigstop(self):
484 self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "")
485@@ -93,10 +98,14 @@
486 def test_expect_sigstop(self):
487 self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "1")
488 self._launch_unity()
489- self.assertThat(lambda: os.WIFSTOPPED(self._get_status()), Eventually(Equals(True)), "Unity8 should raise SIGSTOP when ready")
490+ self.assertThat(
491+ lambda: os.WIFSTOPPED(self._get_status()),
492+ Eventually(Equals(True)), "Unity8 should raise SIGSTOP when ready")
493
494 self.process.send_signal(signal.SIGCONT)
495- self.assertThat(lambda: os.WIFCONTINUED(self._get_status()), Eventually(Equals(True)), "Unity8 should have resumed")
496+ self.assertThat(
497+ lambda: os.WIFCONTINUED(self._get_status()),
498+ Eventually(Equals(True)), "Unity8 should have resumed")
499
500 logger.debug("Unity started, waiting for it to be ready.")
501 self._set_proxy()
502
503=== modified file 'tests/whitespace/check_whitespace.py'
504--- tests/whitespace/check_whitespace.py 2013-06-05 22:03:08 +0000
505+++ tests/whitespace/check_whitespace.py 2014-06-29 05:34:12 +0000
506@@ -1,7 +1,7 @@
507 #! /usr/bin/env python3
508
509 #
510-# Copyright (C) 2013 Canonical Ltd
511+# Copyright (C) 2013, 2014 Canonical Ltd
512 #
513 # This program is free software: you can redistribute it and/or modify
514 # it under the terms of the GNU General Public License version 3 as
515@@ -19,8 +19,8 @@
516 #
517
518 #
519-# Little helper program to test that source files do not contain trailing whitespace
520-# or tab indentation.
521+# Little helper program to test that source files do not contain trailing
522+# whitespace or tab indentation.
523 #
524 # Usage: check_whitespace.py directory [ignore_prefix]
525 #
526@@ -31,18 +31,20 @@
527 # See the file_pat definition below for a list of files that are checked.
528 #
529
530+from __future__ import print_function
531+
532 import argparse
533 import os
534 import re
535 import sys
536
537+
538 # Print msg on stderr, preceded by program name and followed by newline
539-
540 def error(msg):
541 print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr)
542
543+
544 # Function to raise errors encountered by os.walk
545-
546 def raise_error(e):
547 raise e
548
549@@ -52,6 +54,7 @@
550 whitespace_pat = re.compile(r'.*[ \t]$')
551 tab_indent_pat = re.compile(r'^ *\t')
552
553+
554 def scan_for_bad_whitespace(file_path):
555 global tab_indent_pat, whitespace_pat
556 errors = []
557@@ -69,7 +72,9 @@
558 plural = 's'
559 else:
560 plural = ''
561- print("%s: bad whitespace in line%s %s" % (file_path, plural, ", ".join((str(i) for i in errors))))
562+ print(
563+ "%s: bad whitespace in line%s %s" % (
564+ file_path, plural, ", ".join((str(i) for i in errors))))
565 elif errors:
566 print("%s: bad whitespace in multiple lines" % file_path)
567 if newlines_at_end:
568@@ -78,15 +83,20 @@
569
570 # Parse args
571
572-parser = argparse.ArgumentParser(description = 'Test that source files do not contain trailing whitespace.')
573-parser.add_argument('dir', nargs = 1, help = 'The directory to (recursively) search for source files')
574-parser.add_argument('ignore_prefix', nargs = '?', default=None,
575- help = 'Ignore source files with a path that starts with the given prefix.')
576+parser = argparse.ArgumentParser(
577+ description='Test that source files do not contain trailing whitespace.')
578+parser.add_argument(
579+ 'dir', nargs=1,
580+ help='The directory to (recursively) search for source files')
581+parser.add_argument(
582+ 'ignore_prefix', nargs='?', default=None,
583+ help='Ignore source files with a path that starts with the given prefix.')
584 args = parser.parse_args()
585
586 # Files we want to check for trailing whitespace.
587
588-file_pat = r'(.*\.(c|cpp|h|hpp|hh|in|install|js|py|qml|sh)$)|(.*CMakeLists\.txt$)'
589+file_pat = (
590+ r'(.*\.(c|cpp|h|hpp|hh|in|install|js|py|qml|sh)$)|(.*CMakeLists\.txt$)')
591 pat = re.compile(file_pat)
592
593 # Find all the files with matching file extension in the specified
594@@ -97,7 +107,7 @@
595
596 found_whitespace = False
597 try:
598- for root, dirs, files in os.walk(directory, onerror = raise_error):
599+ for root, dirs, files in os.walk(directory, onerror=raise_error):
600 for file in files:
601 path = os.path.join(root, file)
602 if not (ignore and path.startswith(ignore)) and pat.match(file):

Subscribers

People subscribed via source and target branches