Merge ~muktupavels/unity:master into unity:master

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 9e9ae41e576915b185a9bcdf65327f8eee60f70e
Merged at revision: c6d44edb7479b146b7428a526127ed45fdf2b3a0
Proposed branch: ~muktupavels/unity:master
Merge into: unity:master
Diff against target: 891 lines (+59/-104)
47 files modified
debian/control (+10/-11)
debian/rules (+2/-2)
tests/autopilot/unity/emulators/X11.py (+1/-2)
tests/autopilot/unity/emulators/compiz.py (+0/-2)
tests/autopilot/unity/emulators/dash.py (+0/-1)
tests/autopilot/unity/emulators/hud.py (+2/-3)
tests/autopilot/unity/emulators/ibus.py (+1/-2)
tests/autopilot/unity/emulators/icons.py (+0/-1)
tests/autopilot/unity/emulators/launcher.py (+2/-3)
tests/autopilot/unity/emulators/panel.py (+2/-3)
tests/autopilot/unity/emulators/quicklist.py (+0/-1)
tests/autopilot/unity/emulators/screen.py (+0/-1)
tests/autopilot/unity/emulators/shortcut_hint.py (+0/-1)
tests/autopilot/unity/emulators/switcher.py (+1/-2)
tests/autopilot/unity/emulators/tooltip.py (+0/-1)
tests/autopilot/unity/emulators/unity.py (+0/-1)
tests/autopilot/unity/emulators/window_manager.py (+0/-1)
tests/autopilot/unity/emulators/workspace.py (+0/-1)
tests/autopilot/unity/tests/__init__.py (+0/-1)
tests/autopilot/unity/tests/launcher/test_capture.py (+0/-1)
tests/autopilot/unity/tests/launcher/test_icon_behavior.py (+0/-1)
tests/autopilot/unity/tests/launcher/test_keynav.py (+0/-1)
tests/autopilot/unity/tests/launcher/test_reveal.py (+0/-1)
tests/autopilot/unity/tests/launcher/test_scroll.py (+0/-1)
tests/autopilot/unity/tests/launcher/test_shortcut.py (+0/-1)
tests/autopilot/unity/tests/launcher/test_switcher.py (+0/-1)
tests/autopilot/unity/tests/launcher/test_visual.py (+0/-1)
tests/autopilot/unity/tests/test_command_lens.py (+0/-1)
tests/autopilot/unity/tests/test_dash.py (+4/-5)
tests/autopilot/unity/tests/test_gnome_key_grabber.py (+1/-1)
tests/autopilot/unity/tests/test_gobject_introspection.py (+0/-1)
tests/autopilot/unity/tests/test_home_lens.py (+0/-1)
tests/autopilot/unity/tests/test_hud.py (+2/-3)
tests/autopilot/unity/tests/test_ibus.py (+12/-13)
tests/autopilot/unity/tests/test_panel.py (+0/-1)
tests/autopilot/unity/tests/test_quicklist.py (+0/-1)
tests/autopilot/unity/tests/test_search.py (+0/-1)
tests/autopilot/unity/tests/test_shopping_lens.py (+3/-4)
tests/autopilot/unity/tests/test_shortcut_hint.py (+0/-1)
tests/autopilot/unity/tests/test_showdesktop.py (+0/-1)
tests/autopilot/unity/tests/test_spread.py (+0/-1)
tests/autopilot/unity/tests/test_switcher.py (+0/-1)
tests/autopilot/unity/tests/test_unity_logging.py (+0/-2)
tests/autopilot/unity/tests/test_wm_keybindings.py (+0/-1)
tests/autopilot/unity/tests/xim/test_gcin.py (+3/-4)
tools/makebootchart.py (+5/-5)
tools/unity-introspection-visualiser.py (+8/-8)
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Dmitry Shachnev Pending
Review via email: mp+359969@code.launchpad.net

Commit message

Port to Python 3.

Description of the change

Port to Python 3.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/control b/debian/control
2index c3dc0cf..a5d3041 100644
3--- a/debian/control
4+++ b/debian/control
5@@ -50,9 +50,8 @@ Build-Depends: cmake,
6 libxtst-dev,
7 libzeitgeist-2.0-dev,
8 pkg-config,
9- python (>= 2.7),
10- python3 (>= 3.4),
11- python-setuptools,
12+ python3-all (>= 3.4),
13+ python3-setuptools,
14 quilt,
15 systemd,
16 xserver-xorg-video-dummy,
17@@ -194,19 +193,19 @@ Package: unity-autopilot
18 Section: python
19 Architecture: all
20 Depends: ${misc:Depends},
21- ${python:Depends},
22- autopilot-desktop-legacy,
23- python-windowmocker,
24+ ${python3:Depends},
25+ autopilot-desktop,
26+ python3-windowmocker,
27 gir1.2-appindicator3-0.1,
28 gir1.2-dee-1.0,
29 gir1.2-glib-2.0,
30 gir1.2-ibus-1.0,
31 gir1.2-unity-5.0,
32- python-compizconfig,
33- python-dbus,
34- python-testtools,
35- python-xdg,
36- python-xlib,
37+ python3-compizconfig,
38+ python3-dbus,
39+ python3-testtools,
40+ python3-xdg,
41+ python3-xlib,
42 libxpathselect1.4v5 (>= 1.4),
43 mesa-utils,
44 Description: Autopiloted tests for Unity
45diff --git a/debian/rules b/debian/rules
46index fea379d..4b29c43 100755
47--- a/debian/rules
48+++ b/debian/rules
49@@ -36,7 +36,7 @@ override_dh_auto_configure:
50 override_dh_install:
51 # install autopilot tests
52 cd tests/autopilot; \
53- set -ex; for python in $(shell pyversions -r); do \
54+ set -ex; for python in $(shell py3versions -r); do \
55 $$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
56 done; \
57 cd $(CURDIR)
58@@ -59,4 +59,4 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
59 endif
60
61 %:
62- dh $@ --with translations,quilt,python2,python3,migrations --parallel
63+ dh $@ --with translations,quilt,python3,migrations --parallel
64diff --git a/tests/autopilot/unity/emulators/X11.py b/tests/autopilot/unity/emulators/X11.py
65index 3bbf89d..a49efa7 100644
66--- a/tests/autopilot/unity/emulators/X11.py
67+++ b/tests/autopilot/unity/emulators/X11.py
68@@ -1,4 +1,3 @@
69-from __future__ import absolute_import
70
71 from autopilot.utilities import Silence
72 from autopilot.display import Display
73@@ -90,7 +89,7 @@ def set_primary_monitor(monitor):
74 """
75 try:
76 glxinfo_out = subprocess.check_output("glxinfo")
77- except OSError, e:
78+ except OSError as e:
79 raise OSError("Failed to run glxinfo: %s. (do you have mesa-utils installed?)" % e)
80
81 for dri in _blacklisted_drivers:
82diff --git a/tests/autopilot/unity/emulators/compiz.py b/tests/autopilot/unity/emulators/compiz.py
83index abdc98f..4b7c375 100644
84--- a/tests/autopilot/unity/emulators/compiz.py
85+++ b/tests/autopilot/unity/emulators/compiz.py
86@@ -1,8 +1,6 @@
87-from __future__ import absolute_import
88
89 """Functions that wrap compizconfig to avoid some unpleasantness in that module."""
90
91-from __future__ import absolute_import
92
93 from autopilot.utilities import Silence
94
95diff --git a/tests/autopilot/unity/emulators/dash.py b/tests/autopilot/unity/emulators/dash.py
96index 8511d64..e4fcfe3 100644
97--- a/tests/autopilot/unity/emulators/dash.py
98+++ b/tests/autopilot/unity/emulators/dash.py
99@@ -7,7 +7,6 @@
100 # by the Free Software Foundation.
101 #
102
103-from __future__ import absolute_import
104
105 from autopilot.input import Keyboard, Mouse
106
107diff --git a/tests/autopilot/unity/emulators/hud.py b/tests/autopilot/unity/emulators/hud.py
108index 81e184c..fc24a05 100644
109--- a/tests/autopilot/unity/emulators/hud.py
110+++ b/tests/autopilot/unity/emulators/hud.py
111@@ -7,14 +7,13 @@
112 # by the Free Software Foundation.
113 #
114
115-from __future__ import absolute_import
116
117 from logging import getLogger
118
119 from autopilot.input import Keyboard
120 from autopilot.introspection.dbus import StateNotFoundError
121 from autopilot.keybindings import KeybindingsHelper
122-from HTMLParser import HTMLParser
123+from html.parser import HTMLParser
124 import re
125
126 from unity.emulators import UnityIntrospectionObject
127@@ -125,7 +124,7 @@ class HudController(UnityIntrospectionObject, KeybindingsHelper):
128 try:
129 if len(self.hud_buttons) is 0:
130 return 0
131- [button] = filter(lambda x: x.focused, self.hud_buttons)
132+ [button] = [x for x in self.hud_buttons if x.focused]
133 return button
134 except IndexError:
135 raise RuntimeError("No HUD buttons found, is hud active?")
136diff --git a/tests/autopilot/unity/emulators/ibus.py b/tests/autopilot/unity/emulators/ibus.py
137index b21d99c..9ae4fbe 100644
138--- a/tests/autopilot/unity/emulators/ibus.py
139+++ b/tests/autopilot/unity/emulators/ibus.py
140@@ -20,7 +20,6 @@
141
142 """Functions to deal with ibus service."""
143
144-from __future__ import absolute_import
145
146 from gi.repository import IBus, GLib
147 import os
148@@ -93,7 +92,7 @@ def set_active_engines(engine_list):
149 raise TypeError("engine_list must be a list of valid engine names.")
150 available_engines = get_available_input_engines()
151 for engine in engine_list:
152- if not isinstance(engine, basestring):
153+ if not isinstance(engine, str):
154 raise TypeError("Engines in engine_list must all be strings.")
155 if engine not in available_engines:
156 raise ValueError(
157diff --git a/tests/autopilot/unity/emulators/icons.py b/tests/autopilot/unity/emulators/icons.py
158index 8230194..15ac171 100644
159--- a/tests/autopilot/unity/emulators/icons.py
160+++ b/tests/autopilot/unity/emulators/icons.py
161@@ -7,7 +7,6 @@
162 # by the Free Software Foundation.
163 #
164
165-from __future__ import absolute_import
166
167 from unity.emulators import UnityIntrospectionObject
168 from unity.emulators.quicklist import Quicklist
169diff --git a/tests/autopilot/unity/emulators/launcher.py b/tests/autopilot/unity/emulators/launcher.py
170index f846f3c..b95ec59 100644
171--- a/tests/autopilot/unity/emulators/launcher.py
172+++ b/tests/autopilot/unity/emulators/launcher.py
173@@ -7,7 +7,6 @@
174 # by the Free Software Foundation.
175 #
176
177-from __future__ import absolute_import
178
179 from autopilot.input import Mouse
180 from autopilot.display import Display, move_mouse_to_screen
181@@ -136,7 +135,7 @@ class Launcher(UnityIntrospectionObject, KeybindingsHelper):
182 found = False
183
184 # Only try 10 times (5 secs.) before giving up.
185- for i in xrange(0, 10):
186+ for i in range(0, 10):
187 mouse_x = target_x = icon.center.x
188 mouse_y = target_y = icon.center.y
189 if target_y > h + y:
190@@ -225,7 +224,7 @@ class Launcher(UnityIntrospectionObject, KeybindingsHelper):
191 continue
192 logger.debug("Selected icon = %s", icon.tooltip_text)
193 matches = True
194- for arg,val in kwargs.iteritems():
195+ for arg,val in kwargs.items():
196 if not hasattr(icon, arg) or getattr(icon, arg, None) != val:
197 matches = False
198 break
199diff --git a/tests/autopilot/unity/emulators/panel.py b/tests/autopilot/unity/emulators/panel.py
200index 78b1085..71502f1 100644
201--- a/tests/autopilot/unity/emulators/panel.py
202+++ b/tests/autopilot/unity/emulators/panel.py
203@@ -7,7 +7,6 @@
204 # by the Free Software Foundation.
205 #
206
207-from __future__ import absolute_import
208
209 import logging
210 from time import sleep
211@@ -132,14 +131,14 @@ class UnityPanel(UnityIntrospectionObject, KeybindingsHelper):
212 def get_active_indicator(self):
213 """Returns the indicator entry that is currently active"""
214 entries = self.get_indicator_entries(False, True)
215- entries = filter(lambda e: e.active == True, entries)
216+ entries = [e for e in entries if e.active == True]
217 assert(len(entries) <= 1)
218 return entries[0] if entries else None
219
220 def get_indicator_entry(self, entry_id):
221 """Returns the indicator entry for the given ID or None"""
222 entries = self.get_indicator_entries(False, True)
223- entries = filter(lambda e: e.entry_id == entry_id, entries)
224+ entries = [e for e in entries if e.entry_id == entry_id]
225 assert(len(entries) <= 1)
226 return entries[0] if entries else None
227
228diff --git a/tests/autopilot/unity/emulators/quicklist.py b/tests/autopilot/unity/emulators/quicklist.py
229index 42601bd..bfb7938 100644
230--- a/tests/autopilot/unity/emulators/quicklist.py
231+++ b/tests/autopilot/unity/emulators/quicklist.py
232@@ -7,7 +7,6 @@
233 # by the Free Software Foundation.
234 #
235
236-from __future__ import absolute_import
237
238 import logging
239
240diff --git a/tests/autopilot/unity/emulators/screen.py b/tests/autopilot/unity/emulators/screen.py
241index b9299a2..c570178 100644
242--- a/tests/autopilot/unity/emulators/screen.py
243+++ b/tests/autopilot/unity/emulators/screen.py
244@@ -7,7 +7,6 @@
245 # by the Free Software Foundation.
246 #
247
248-from __future__ import absolute_import
249
250 import logging
251 from unity.emulators import UnityIntrospectionObject
252diff --git a/tests/autopilot/unity/emulators/shortcut_hint.py b/tests/autopilot/unity/emulators/shortcut_hint.py
253index 279b4f1..8448308 100644
254--- a/tests/autopilot/unity/emulators/shortcut_hint.py
255+++ b/tests/autopilot/unity/emulators/shortcut_hint.py
256@@ -7,7 +7,6 @@
257 # by the Free Software Foundation.
258 #
259
260-from __future__ import absolute_import
261
262 import logging
263
264diff --git a/tests/autopilot/unity/emulators/switcher.py b/tests/autopilot/unity/emulators/switcher.py
265index 9bd9a25..4b5df9b 100644
266--- a/tests/autopilot/unity/emulators/switcher.py
267+++ b/tests/autopilot/unity/emulators/switcher.py
268@@ -7,7 +7,6 @@
269 # by the Free Software Foundation.
270 #
271
272-from __future__ import absolute_import
273
274 import logging
275
276@@ -152,7 +151,7 @@ class SwitcherController(UnityIntrospectionObject, KeybindingsHelper):
277 for i in self.model.icons:
278 current_icon = self.current_icon
279 passed=True
280- for key,val in kwargs.iteritems():
281+ for key,val in kwargs.items():
282 if not hasattr(current_icon, key) or getattr(current_icon, key) != val:
283 passed=False
284 if passed:
285diff --git a/tests/autopilot/unity/emulators/tooltip.py b/tests/autopilot/unity/emulators/tooltip.py
286index 17c3740..6ab4f39 100644
287--- a/tests/autopilot/unity/emulators/tooltip.py
288+++ b/tests/autopilot/unity/emulators/tooltip.py
289@@ -7,7 +7,6 @@
290 # by the Free Software Foundation.
291 #
292
293-from __future__ import absolute_import
294
295 from unity.emulators import UnityIntrospectionObject
296
297diff --git a/tests/autopilot/unity/emulators/unity.py b/tests/autopilot/unity/emulators/unity.py
298index 22fdde1..418ffa1 100644
299--- a/tests/autopilot/unity/emulators/unity.py
300+++ b/tests/autopilot/unity/emulators/unity.py
301@@ -7,7 +7,6 @@
302 # by the Free Software Foundation.
303 #
304
305-from __future__ import absolute_import
306
307 from dbus import Interface, SessionBus
308
309diff --git a/tests/autopilot/unity/emulators/window_manager.py b/tests/autopilot/unity/emulators/window_manager.py
310index d07fec8..527046b 100644
311--- a/tests/autopilot/unity/emulators/window_manager.py
312+++ b/tests/autopilot/unity/emulators/window_manager.py
313@@ -7,7 +7,6 @@
314 # by the Free Software Foundation.
315 #
316
317-from __future__ import absolute_import
318
319 import logging
320 from autopilot.introspection.types import Rectangle
321diff --git a/tests/autopilot/unity/emulators/workspace.py b/tests/autopilot/unity/emulators/workspace.py
322index a13972c..ce929cf 100644
323--- a/tests/autopilot/unity/emulators/workspace.py
324+++ b/tests/autopilot/unity/emulators/workspace.py
325@@ -7,7 +7,6 @@
326 # by the Free Software Foundation.
327 #
328
329-from __future__ import absolute_import
330
331 from autopilot.keybindings import KeybindingsHelper
332 from autopilot.display import Display
333diff --git a/tests/autopilot/unity/tests/__init__.py b/tests/autopilot/unity/tests/__init__.py
334index da114f9..4c62c09 100644
335--- a/tests/autopilot/unity/tests/__init__.py
336+++ b/tests/autopilot/unity/tests/__init__.py
337@@ -8,7 +8,6 @@
338
339 """Autopilot test case class for Unity-specific tests."""
340
341-from __future__ import absolute_import
342
343
344 from codecs import open
345diff --git a/tests/autopilot/unity/tests/launcher/test_capture.py b/tests/autopilot/unity/tests/launcher/test_capture.py
346index 24da2a7..28d59c3 100644
347--- a/tests/autopilot/unity/tests/launcher/test_capture.py
348+++ b/tests/autopilot/unity/tests/launcher/test_capture.py
349@@ -7,7 +7,6 @@
350 # under the terms of the GNU General Public License version 3, as published
351 # by the Free Software Foundation.
352
353-from __future__ import absolute_import
354
355 from autopilot.matchers import Eventually
356 import logging
357diff --git a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
358index b51267d..f8876ba 100644
359--- a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
360+++ b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
361@@ -7,7 +7,6 @@
362 # under the terms of the GNU General Public License version 3, as published
363 # by the Free Software Foundation.
364
365-from __future__ import absolute_import
366
367 from autopilot.matchers import Eventually
368 from autopilot.testcase import multiply_scenarios
369diff --git a/tests/autopilot/unity/tests/launcher/test_keynav.py b/tests/autopilot/unity/tests/launcher/test_keynav.py
370index 85b2bad..57a9ccc 100644
371--- a/tests/autopilot/unity/tests/launcher/test_keynav.py
372+++ b/tests/autopilot/unity/tests/launcher/test_keynav.py
373@@ -7,7 +7,6 @@
374 # under the terms of the GNU General Public License version 3, as published
375 # by the Free Software Foundation.
376
377-from __future__ import absolute_import
378
379 from autopilot.matchers import Eventually
380 import logging
381diff --git a/tests/autopilot/unity/tests/launcher/test_reveal.py b/tests/autopilot/unity/tests/launcher/test_reveal.py
382index 7d57f12..2bc6d22 100644
383--- a/tests/autopilot/unity/tests/launcher/test_reveal.py
384+++ b/tests/autopilot/unity/tests/launcher/test_reveal.py
385@@ -7,7 +7,6 @@
386 # under the terms of the GNU General Public License version 3, as published
387 # by the Free Software Foundation.
388
389-from __future__ import absolute_import
390
391 from autopilot.display import move_mouse_to_screen
392 from autopilot.matchers import Eventually
393diff --git a/tests/autopilot/unity/tests/launcher/test_scroll.py b/tests/autopilot/unity/tests/launcher/test_scroll.py
394index 5e500c7..8dcac19 100644
395--- a/tests/autopilot/unity/tests/launcher/test_scroll.py
396+++ b/tests/autopilot/unity/tests/launcher/test_scroll.py
397@@ -6,7 +6,6 @@
398 # under the terms of the GNU General Public License version 3, as published
399 # by the Free Software Foundation.
400
401-from __future__ import absolute_import
402
403 from autopilot.matchers import Eventually
404 import logging
405diff --git a/tests/autopilot/unity/tests/launcher/test_shortcut.py b/tests/autopilot/unity/tests/launcher/test_shortcut.py
406index 28d6613..9aafc4f 100644
407--- a/tests/autopilot/unity/tests/launcher/test_shortcut.py
408+++ b/tests/autopilot/unity/tests/launcher/test_shortcut.py
409@@ -7,7 +7,6 @@
410 # under the terms of the GNU General Public License version 3, as published
411 # by the Free Software Foundation.
412
413-from __future__ import absolute_import
414
415 from autopilot.matchers import Eventually
416 import logging
417diff --git a/tests/autopilot/unity/tests/launcher/test_switcher.py b/tests/autopilot/unity/tests/launcher/test_switcher.py
418index 657cc23..833c03e 100644
419--- a/tests/autopilot/unity/tests/launcher/test_switcher.py
420+++ b/tests/autopilot/unity/tests/launcher/test_switcher.py
421@@ -7,7 +7,6 @@
422 # under the terms of the GNU General Public License version 3, as published
423 # by the Free Software Foundation.
424
425-from __future__ import absolute_import
426
427 from autopilot.matchers import Eventually
428
429diff --git a/tests/autopilot/unity/tests/launcher/test_visual.py b/tests/autopilot/unity/tests/launcher/test_visual.py
430index c44e923..262a2cb 100644
431--- a/tests/autopilot/unity/tests/launcher/test_visual.py
432+++ b/tests/autopilot/unity/tests/launcher/test_visual.py
433@@ -7,7 +7,6 @@
434 # under the terms of the GNU General Public License version 3, as published
435 # by the Free Software Foundation.
436
437-from __future__ import absolute_import
438
439 from autopilot.matchers import Eventually
440 import logging
441diff --git a/tests/autopilot/unity/tests/test_command_lens.py b/tests/autopilot/unity/tests/test_command_lens.py
442index acafc49..4076c01 100644
443--- a/tests/autopilot/unity/tests/test_command_lens.py
444+++ b/tests/autopilot/unity/tests/test_command_lens.py
445@@ -6,7 +6,6 @@
446 # under the terms of the GNU General Public License version 3, as published
447 # by the Free Software Foundation.
448
449-from __future__ import absolute_import
450
451 from autopilot.matchers import Eventually
452 from testtools.matchers import Equals, NotEquals, GreaterThan, MatchesPredicate
453diff --git a/tests/autopilot/unity/tests/test_dash.py b/tests/autopilot/unity/tests/test_dash.py
454index 8f4943a..c7b2106 100644
455--- a/tests/autopilot/unity/tests/test_dash.py
456+++ b/tests/autopilot/unity/tests/test_dash.py
457@@ -6,7 +6,6 @@
458 # under the terms of the GNU General Public License version 3, as published
459 # by the Free Software Foundation.
460
461-from __future__ import absolute_import
462
463 from autopilot.clipboard import get_clipboard_contents
464 from autopilot.display import move_mouse_to_screen
465@@ -266,14 +265,14 @@ class DashMultiKeyTests(DashSearchInputTests):
466 self.unity.dash.reveal_application_scope()
467 self.keyboard.press_and_release('Multi_key')
468 self.keyboard.type("^o")
469- self.assertSearchText(u'\xf4')
470+ self.assertSearchText('\xf4')
471
472 def test_multi_key_copyright(self):
473 """Pressing the sequences 'Multi_key' + 'c' + 'o' must produce '©'."""
474 self.unity.dash.reveal_application_scope()
475 self.keyboard.press_and_release('Multi_key')
476 self.keyboard.type("oc")
477- self.assertSearchText(u'\xa9')
478+ self.assertSearchText('\xa9')
479
480 def test_multi_key_delete(self):
481 """Pressing 'Multi_key' must not get stuck looking for a sequence."""
482@@ -382,7 +381,7 @@ class DashKeyNavTests(DashTestCase):
483 self.keyboard.release('Control')
484
485 scopebar = self.unity.dash.view.get_scopebar()
486- self.assertEqual(scopebar.active_scope, u'applications.scope')
487+ self.assertEqual(scopebar.active_scope, 'applications.scope')
488
489 self.keyboard.press('Control')
490 self.keyboard.press('Shift')
491@@ -722,7 +721,7 @@ class DashScopeBarTests(DashTestCase):
492 """Scope selection should work when clicking in
493 the rectangle outside of the icon.
494 """
495- app_icon = self.scopebar.get_icon_by_name(u'applications.scope')
496+ app_icon = self.scopebar.get_icon_by_name('applications.scope')
497 self.mouse.click_object(app_icon)
498
499 self.assertThat(self.scopebar.active_scope, Eventually(Equals('applications.scope')))
500diff --git a/tests/autopilot/unity/tests/test_gnome_key_grabber.py b/tests/autopilot/unity/tests/test_gnome_key_grabber.py
501index d7c49f6..e0767b1 100644
502--- a/tests/autopilot/unity/tests/test_gnome_key_grabber.py
503+++ b/tests/autopilot/unity/tests/test_gnome_key_grabber.py
504@@ -135,7 +135,7 @@ class GnomeKeyGrabberTests(unity.tests.UnityTestCase):
505 self.check_accelerator(accelerator)
506
507 def test_grab_same_accelerator(self):
508- accelerators = [Accelerator('<Shift><Control><Alt>b', 'Shift+Control+Alt+b') for i in xrange(3)]
509+ accelerators = [Accelerator('<Shift><Control><Alt>b', 'Shift+Control+Alt+b') for i in range(3)]
510 actions = self.interface.GrabAccelerators([(accelerator.accelerator, 0) for accelerator in accelerators])
511
512 self.activatable.clear()
513diff --git a/tests/autopilot/unity/tests/test_gobject_introspection.py b/tests/autopilot/unity/tests/test_gobject_introspection.py
514index 58a0c38..d1a7573 100755
515--- a/tests/autopilot/unity/tests/test_gobject_introspection.py
516+++ b/tests/autopilot/unity/tests/test_gobject_introspection.py
517@@ -6,7 +6,6 @@
518 # under the terms of the GNU General Public License version 3, as published
519 # by the Free Software Foundation.
520
521-from __future__ import absolute_import
522
523 from testtools import TestCase
524
525diff --git a/tests/autopilot/unity/tests/test_home_lens.py b/tests/autopilot/unity/tests/test_home_lens.py
526index 4094d84..f880666 100644
527--- a/tests/autopilot/unity/tests/test_home_lens.py
528+++ b/tests/autopilot/unity/tests/test_home_lens.py
529@@ -6,7 +6,6 @@
530 # under the terms of the GNU General Public License version 3, as published
531 # by the Free Software Foundation.
532
533-from __future__ import absolute_import
534
535 from autopilot.matchers import Eventually
536 from testtools.matchers import Equals
537diff --git a/tests/autopilot/unity/tests/test_hud.py b/tests/autopilot/unity/tests/test_hud.py
538index 310ceb1..719c7fd 100644
539--- a/tests/autopilot/unity/tests/test_hud.py
540+++ b/tests/autopilot/unity/tests/test_hud.py
541@@ -7,7 +7,6 @@
542 # under the terms of the GNU General Public License version 3, as published
543 # by the Free Software Foundation.
544
545-from __future__ import absolute_import
546
547 from autopilot.matchers import Eventually
548 from autopilot.display import Display, move_mouse_to_screen, is_rect_on_screen
549@@ -230,7 +229,7 @@ class HudBehaviorTests(HudTestsBase):
550
551 self.keyboard.type("save")
552
553- self.hud_query_check(u'Save\u2002(File)')
554+ self.hud_query_check('Save\u2002(File)')
555
556 self.keyboard.press_and_release('Return')
557 self.addCleanup(self.keyboard.press_and_release, "Ctrl+s")
558@@ -338,7 +337,7 @@ class HudBehaviorTests(HudTestsBase):
559 self.keyboard.type("Quit")
560 self.assertThat(self.unity.hud.search_string, Eventually(Equals("Quit")))
561
562- self.hud_query_check(u'Quit\u2002(File)')
563+ self.hud_query_check('Quit\u2002(File)')
564
565 self.keyboard.press_and_release("Enter")
566
567diff --git a/tests/autopilot/unity/tests/test_ibus.py b/tests/autopilot/unity/tests/test_ibus.py
568index 580e5b8..5173dd7 100644
569--- a/tests/autopilot/unity/tests/test_ibus.py
570+++ b/tests/autopilot/unity/tests/test_ibus.py
571@@ -8,7 +8,6 @@
572
573 """Tests to ensure unity is compatible with ibus input method."""
574
575-from __future__ import absolute_import
576
577 from unity.emulators.ibus import (
578 get_active_input_engines,
579@@ -85,7 +84,7 @@ class IBusQuery:
580 timeout.start()
581 while self._context.get_engine() is None:
582 if self._abort is True:
583- print "Error! Could not set the engine correctly."
584+ print ("Error! Could not set the engine correctly.")
585 return None
586 continue
587 timeout.cancel()
588@@ -99,7 +98,7 @@ class IBusQuery:
589 GLib.timeout_add_seconds(5, lambda *args: self._glibloop.quit())
590 self._glibloop.run()
591
592- return unicode(self.result, "UTF-8")
593+ return str(self.result, "UTF-8")
594
595
596
597@@ -240,10 +239,10 @@ class IBusTestsPinyin(IBusWidgetScenariodTests):
598 scenarios = multiply_scenarios(
599 IBusWidgetScenariodTests.scenarios,
600 [
601- ('photo', {'input': 'zhaopian ', 'result' : u'\u7167\u7247' }),
602- ('internet', {'input': 'hulianwang ', 'result' : u'\u4e92\u8054\u7f51'}),
603- ('hello', {'input': 'ninhao ', 'result' : u'\u60a8\u597d' }),
604- ('management', {'input': 'guanli ', 'result' : u'\u7ba1\u7406' }),
605+ ('photo', {'input': 'zhaopian ', 'result' : '\u7167\u7247' }),
606+ ('internet', {'input': 'hulianwang ', 'result' : '\u4e92\u8054\u7f51'}),
607+ ('hello', {'input': 'ninhao ', 'result' : '\u60a8\u597d' }),
608+ ('management', {'input': 'guanli ', 'result' : '\u7ba1\u7406' }),
609 ]
610 )
611
612@@ -263,9 +262,9 @@ class IBusTestsHangul(IBusWidgetScenariodTests):
613 scenarios = multiply_scenarios(
614 IBusWidgetScenariodTests.scenarios,
615 [
616- ('transmission', {'input': 'xmfostmaltus ', 'result': u'\ud2b8\ub79c\uc2a4\ubbf8\uc158 '}),
617- ('social', {'input': 'httuf ', 'result': u'\uc18c\uc15c '}),
618- ('document', {'input': 'anstj ', 'result': u'\ubb38\uc11c '}),
619+ ('transmission', {'input': 'xmfostmaltus ', 'result': '\ud2b8\ub79c\uc2a4\ubbf8\uc158 '}),
620+ ('social', {'input': 'httuf ', 'result': '\uc18c\uc15c '}),
621+ ('document', {'input': 'anstj ', 'result': '\ubb38\uc11c '}),
622 ]
623 )
624
625@@ -285,9 +284,9 @@ class IBusTestsAnthy(IBusWidgetScenariodTests):
626 scenarios = multiply_scenarios(
627 IBusWidgetScenariodTests.scenarios,
628 [
629- ('system', {'input': 'shisutemu ', 'result' : u'\u30b7\u30b9\u30c6\u30e0' }),
630- ('game', {'input': 'ge-mu ', 'result' : u'\u30b2\u30fc\u30e0' }),
631- ('user', {'input': 'yu-za- ', 'result' : u'\u30e6\u30fc\u30b6\u30fc' }),
632+ ('system', {'input': 'shisutemu ', 'result' : '\u30b7\u30b9\u30c6\u30e0' }),
633+ ('game', {'input': 'ge-mu ', 'result' : '\u30b2\u30fc\u30e0' }),
634+ ('user', {'input': 'yu-za- ', 'result' : '\u30e6\u30fc\u30b6\u30fc' }),
635 ],
636 [
637 ('commit_enter', {'commit_key': 'Enter'}),
638diff --git a/tests/autopilot/unity/tests/test_panel.py b/tests/autopilot/unity/tests/test_panel.py
639index 634fd93..d2119ab 100644
640--- a/tests/autopilot/unity/tests/test_panel.py
641+++ b/tests/autopilot/unity/tests/test_panel.py
642@@ -6,7 +6,6 @@
643 # under the terms of the GNU General Public License version 3, as published
644 # by the Free Software Foundation.
645
646-from __future__ import absolute_import
647
648 from autopilot.display import Display
649 #from autopilot.emulators.bamf import BamfWindow
650diff --git a/tests/autopilot/unity/tests/test_quicklist.py b/tests/autopilot/unity/tests/test_quicklist.py
651index a6a1971..32c3566 100644
652--- a/tests/autopilot/unity/tests/test_quicklist.py
653+++ b/tests/autopilot/unity/tests/test_quicklist.py
654@@ -7,7 +7,6 @@
655 # under the terms of the GNU General Public License version 3, as published
656 # by the Free Software Foundation.
657
658-from __future__ import absolute_import
659
660 from autopilot.display import move_mouse_to_screen
661 from autopilot.matchers import Eventually
662diff --git a/tests/autopilot/unity/tests/test_search.py b/tests/autopilot/unity/tests/test_search.py
663index 87d038b..d7297b1 100644
664--- a/tests/autopilot/unity/tests/test_search.py
665+++ b/tests/autopilot/unity/tests/test_search.py
666@@ -6,7 +6,6 @@
667 # under the terms of the GNU General Public License version 3, as published
668 # by the Free Software Foundation.
669
670-from __future__ import absolute_import
671
672 from autopilot.matchers import Eventually
673 from testtools.matchers import (
674diff --git a/tests/autopilot/unity/tests/test_shopping_lens.py b/tests/autopilot/unity/tests/test_shopping_lens.py
675index 94a435d..8f7bcb1 100644
676--- a/tests/autopilot/unity/tests/test_shopping_lens.py
677+++ b/tests/autopilot/unity/tests/test_shopping_lens.py
678@@ -6,12 +6,11 @@
679 # under the terms of the GNU General Public License version 3, as published
680 # by the Free Software Foundation.
681
682-from __future__ import absolute_import
683
684 from autopilot.matchers import Eventually
685 from testtools.matchers import Equals, GreaterThan
686 from time import sleep
687-import urllib2
688+import urllib.request, urllib.error, urllib.parse
689 import gettext
690
691 from unity.tests import UnityTestCase
692@@ -23,8 +22,8 @@ class ShoppingScopeTests(UnityTestCase):
693 def setUp(self):
694 super(ShoppingScopeTests, self).setUp()
695 try:
696- urllib2.urlopen("http://www.google.com", timeout=2)
697- except urllib2.URLError, e:
698+ urllib.request.urlopen("http://www.google.com", timeout=2)
699+ except urllib.error.URLError as e:
700 self.skip("Skipping test, no internet connection")
701 gettext.install("unity-scope-shopping")
702
703diff --git a/tests/autopilot/unity/tests/test_shortcut_hint.py b/tests/autopilot/unity/tests/test_shortcut_hint.py
704index 0320516..899c77a 100644
705--- a/tests/autopilot/unity/tests/test_shortcut_hint.py
706+++ b/tests/autopilot/unity/tests/test_shortcut_hint.py
707@@ -6,7 +6,6 @@
708 # under the terms of the GNU General Public License version 3, as published
709 # by the Free Software Foundation.
710
711-from __future__ import absolute_import
712
713 from autopilot.matchers import Eventually
714 from testtools.matchers import Equals
715diff --git a/tests/autopilot/unity/tests/test_showdesktop.py b/tests/autopilot/unity/tests/test_showdesktop.py
716index 546b716..ce00894 100644
717--- a/tests/autopilot/unity/tests/test_showdesktop.py
718+++ b/tests/autopilot/unity/tests/test_showdesktop.py
719@@ -6,7 +6,6 @@
720 # under the terms of the GNU General Public License version 3, as published
721 # by the Free Software Foundation.
722
723-from __future__ import absolute_import
724
725 from autopilot.matchers import Eventually
726 from testtools.matchers import Equals
727diff --git a/tests/autopilot/unity/tests/test_spread.py b/tests/autopilot/unity/tests/test_spread.py
728index 0cc91a1..961ac1e 100644
729--- a/tests/autopilot/unity/tests/test_spread.py
730+++ b/tests/autopilot/unity/tests/test_spread.py
731@@ -6,7 +6,6 @@
732 # under the terms of the GNU General Public License version 3, as published
733 # by the Free Software Foundation.
734
735-from __future__ import absolute_import
736
737 from autopilot.display import Display
738 from autopilot.matchers import Eventually
739diff --git a/tests/autopilot/unity/tests/test_switcher.py b/tests/autopilot/unity/tests/test_switcher.py
740index d302db1..38d7985 100644
741--- a/tests/autopilot/unity/tests/test_switcher.py
742+++ b/tests/autopilot/unity/tests/test_switcher.py
743@@ -6,7 +6,6 @@
744 # under the terms of the GNU General Public License version 3, as published
745 # by the Free Software Foundation.
746
747-from __future__ import absolute_import
748
749 from autopilot.display import move_mouse_to_screen
750 from autopilot.matchers import Eventually
751diff --git a/tests/autopilot/unity/tests/test_unity_logging.py b/tests/autopilot/unity/tests/test_unity_logging.py
752index 0aa8844..4b106b7 100644
753--- a/tests/autopilot/unity/tests/test_unity_logging.py
754+++ b/tests/autopilot/unity/tests/test_unity_logging.py
755@@ -6,8 +6,6 @@
756 # under the terms of the GNU General Public License version 3, as published
757 # by the Free Software Foundation.
758
759-from __future__ import absolute_import
760-
761 from os import remove
762 from os.path import exists
763 from tempfile import mktemp
764diff --git a/tests/autopilot/unity/tests/test_wm_keybindings.py b/tests/autopilot/unity/tests/test_wm_keybindings.py
765index fe5418d..89390bb 100644
766--- a/tests/autopilot/unity/tests/test_wm_keybindings.py
767+++ b/tests/autopilot/unity/tests/test_wm_keybindings.py
768@@ -6,7 +6,6 @@
769 # under the terms of the GNU General Public License version 3, as published
770 # by the Free Software Foundation.
771
772-from __future__ import absolute_import
773
774 from autopilot.matchers import Eventually
775 from testtools.matchers import Equals, NotEquals, GreaterThan
776diff --git a/tests/autopilot/unity/tests/xim/test_gcin.py b/tests/autopilot/unity/tests/xim/test_gcin.py
777index 81420cd..7f0cda1 100644
778--- a/tests/autopilot/unity/tests/xim/test_gcin.py
779+++ b/tests/autopilot/unity/tests/xim/test_gcin.py
780@@ -6,7 +6,6 @@
781 # under the terms of the GNU General Public License version 3, as published
782 # by the Free Software Foundation.
783
784-from __future__ import absolute_import
785
786 from autopilot.matchers import Eventually
787 from os import environ
788@@ -34,9 +33,9 @@ class GcinTestHangul(GcinTestCase):
789 """Tests the Dash and Hud with gcin in hangul mode."""
790
791 scenarios = [
792- ('hangul', {'input': 'han geul ', 'result': u'\ud55c\uae00'}),
793- ('morning letters', {'input': 'a chimgeul ', 'result': u'\uc544\uce68\uae00'}),
794- ('national script', {'input': 'gug mun ', 'result': u'\uad6d\ubb38'}),
795+ ('hangul', {'input': 'han geul ', 'result': '\ud55c\uae00'}),
796+ ('morning letters', {'input': 'a chimgeul ', 'result': '\uc544\uce68\uae00'}),
797+ ('national script', {'input': 'gug mun ', 'result': '\uad6d\ubb38'}),
798 ]
799
800 def setUp(self):
801diff --git a/tools/makebootchart.py b/tools/makebootchart.py
802index 8915494..15e941a 100755
803--- a/tools/makebootchart.py
804+++ b/tools/makebootchart.py
805@@ -76,7 +76,7 @@ def draw_bg_graph (ctx, seconds, height):
806 ctx.stroke ()
807
808 per_ten = 0
809- for pos in xrange (0, int(total_width), int (0.01 * width_multiplier)):
810+ for pos in range (0, int(total_width), int (0.01 * width_multiplier)):
811 ctx.set_line_width (1)
812 ctx.set_source_rgba (0.0, 0.0, 0.0, 0.10)
813
814@@ -156,7 +156,7 @@ def build_graph (data, filename, info):
815 def build_data_structure (input):
816 reader = csv.reader(open(input))
817 structure = []
818- print "reading", input
819+ print("reading", input)
820 for row in reader:
821 name = row[0]
822 start = float(row[1])
823@@ -168,15 +168,15 @@ def build_data_structure (input):
824
825
826 def usage():
827- print "use --input=filename.log and --output=filename.svg :)"
828+ print("use --input=filename.log and --output=filename.svg :)")
829
830 def main():
831
832 try:
833 opts, args = getopt.getopt(sys.argv[1:], "h", ["help", "output=", "input="])
834- except getopt.GetoptError, err:
835+ except getopt.GetoptError as err:
836 # print help information and exit:
837- print str(err) # will print something like "option -a not recognized"
838+ print(str(err)) # will print something like "option -a not recognized"
839 usage()
840 sys.exit(2)
841
842diff --git a/tools/unity-introspection-visualiser.py b/tools/unity-introspection-visualiser.py
843index c56b241..a30c67e 100755
844--- a/tools/unity-introspection-visualiser.py
845+++ b/tools/unity-introspection-visualiser.py
846@@ -9,16 +9,16 @@ import dbus
847
848 try:
849 from autopilot.emulators.unity import get_state_by_path
850-except ImportError, e:
851- print "Error: could not import the autopilot python module."
852- print "Make sure the autopilot module is in your $PYTHONPATH."
853+except ImportError as e:
854+ print("Error: could not import the autopilot python module.")
855+ print("Make sure the autopilot module is in your $PYTHONPATH.")
856 exit(1)
857
858 try:
859 import pydot
860 except ImportError:
861- print "Error: the 'pydot' module is required to run this script."
862- print "Try installing the 'python-pydot' package."
863+ print("Error: the 'pydot' module is required to run this script.")
864+ print("Try installing the 'python3-pydot' package.")
865 exit(1)
866
867 NEXT_NODE_ID=1
868@@ -53,7 +53,7 @@ def traverse_tree(state, parent, graph):
869 bits = ["%s=%s" % (k, string_rep(state[k])) for k in sorted(state.keys()) if k != 'Children']
870 lbl += "\l".join(bits)
871 parent.set_label(escape('"{' + lbl + '}"'))
872- if state.has_key('Children'):
873+ if 'Children' in state:
874 # Add all array nodes as children of this node.
875 for child_name, child_state in state['Children']:
876 if child_name in NODE_BLACKLIST:
877@@ -94,7 +94,7 @@ if __name__ == '__main__':
878 if hasattr(graph, write_method_name):
879 getattr(graph, write_method_name)(args.output[0])
880 else:
881- print "Error: unsupported format: '%s'" % (extension)
882+ print("Error: unsupported format: '%s'" % (extension))
883 elif args.display:
884 from tempfile import NamedTemporaryFile
885 from subprocess import call
886@@ -104,6 +104,6 @@ if __name__ == '__main__':
887 call(["eog", tf.name])
888 remove(tf.name)
889 else:
890- print 'unknown output mode!'
891+ print('unknown output mode!')
892
893

Subscribers

People subscribed via source and target branches