diff options
| author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2018-12-01 14:34:10 +0200 |
|---|---|---|
| committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2018-12-01 14:34:10 +0200 |
| commit | 9e9ae41e576915b185a9bcdf65327f8eee60f70e (patch) | |
| tree | 458d36dbe62749c41b5ea4758d82e46b36a503bb | |
| parent | 059031e4289647b8171193c18c94ef99da8fc161 (diff) | |
Port to Python 3.
47 files changed, 59 insertions, 104 deletions
diff --git a/debian/control b/debian/control index c3dc0cfc8..a5d30418b 100644 --- a/debian/control +++ b/debian/control @@ -50,9 +50,8 @@ Build-Depends: cmake, libxtst-dev, libzeitgeist-2.0-dev, pkg-config, - python (>= 2.7), - python3 (>= 3.4), - python-setuptools, + python3-all (>= 3.4), + python3-setuptools, quilt, systemd, xserver-xorg-video-dummy, @@ -194,19 +193,19 @@ Package: unity-autopilot Section: python Architecture: all Depends: ${misc:Depends}, - ${python:Depends}, - autopilot-desktop-legacy, - python-windowmocker, + ${python3:Depends}, + autopilot-desktop, + python3-windowmocker, gir1.2-appindicator3-0.1, gir1.2-dee-1.0, gir1.2-glib-2.0, gir1.2-ibus-1.0, gir1.2-unity-5.0, - python-compizconfig, - python-dbus, - python-testtools, - python-xdg, - python-xlib, + python3-compizconfig, + python3-dbus, + python3-testtools, + python3-xdg, + python3-xlib, libxpathselect1.4v5 (>= 1.4), mesa-utils, Description: Autopiloted tests for Unity diff --git a/debian/rules b/debian/rules index fea379dda..4b29c43fb 100755 --- a/debian/rules +++ b/debian/rules @@ -36,7 +36,7 @@ override_dh_auto_configure: override_dh_install: # install autopilot tests cd tests/autopilot; \ - set -ex; for python in $(shell pyversions -r); do \ + set -ex; for python in $(shell py3versions -r); do \ $$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \ done; \ cd $(CURDIR) @@ -59,4 +59,4 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) endif %: - dh $@ --with translations,quilt,python2,python3,migrations --parallel + dh $@ --with translations,quilt,python3,migrations --parallel diff --git a/tests/autopilot/unity/emulators/X11.py b/tests/autopilot/unity/emulators/X11.py index 3bbf89d6e..a49efa7f1 100644 --- a/tests/autopilot/unity/emulators/X11.py +++ b/tests/autopilot/unity/emulators/X11.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import from autopilot.utilities import Silence from autopilot.display import Display @@ -90,7 +89,7 @@ def set_primary_monitor(monitor): """ try: glxinfo_out = subprocess.check_output("glxinfo") - except OSError, e: + except OSError as e: raise OSError("Failed to run glxinfo: %s. (do you have mesa-utils installed?)" % e) for dri in _blacklisted_drivers: diff --git a/tests/autopilot/unity/emulators/compiz.py b/tests/autopilot/unity/emulators/compiz.py index abdc98f45..4b7c37534 100644 --- a/tests/autopilot/unity/emulators/compiz.py +++ b/tests/autopilot/unity/emulators/compiz.py @@ -1,8 +1,6 @@ -from __future__ import absolute_import """Functions that wrap compizconfig to avoid some unpleasantness in that module.""" -from __future__ import absolute_import from autopilot.utilities import Silence diff --git a/tests/autopilot/unity/emulators/dash.py b/tests/autopilot/unity/emulators/dash.py index 8511d64a9..e4fcfe351 100644 --- a/tests/autopilot/unity/emulators/dash.py +++ b/tests/autopilot/unity/emulators/dash.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import from autopilot.input import Keyboard, Mouse diff --git a/tests/autopilot/unity/emulators/hud.py b/tests/autopilot/unity/emulators/hud.py index 81e184c35..fc24a055d 100644 --- a/tests/autopilot/unity/emulators/hud.py +++ b/tests/autopilot/unity/emulators/hud.py @@ -7,14 +7,13 @@ # by the Free Software Foundation. # -from __future__ import absolute_import from logging import getLogger from autopilot.input import Keyboard from autopilot.introspection.dbus import StateNotFoundError from autopilot.keybindings import KeybindingsHelper -from HTMLParser import HTMLParser +from html.parser import HTMLParser import re from unity.emulators import UnityIntrospectionObject @@ -125,7 +124,7 @@ class HudController(UnityIntrospectionObject, KeybindingsHelper): try: if len(self.hud_buttons) is 0: return 0 - [button] = filter(lambda x: x.focused, self.hud_buttons) + [button] = [x for x in self.hud_buttons if x.focused] return button except IndexError: raise RuntimeError("No HUD buttons found, is hud active?") diff --git a/tests/autopilot/unity/emulators/ibus.py b/tests/autopilot/unity/emulators/ibus.py index b21d99c9a..9ae4fbe40 100644 --- a/tests/autopilot/unity/emulators/ibus.py +++ b/tests/autopilot/unity/emulators/ibus.py @@ -20,7 +20,6 @@ """Functions to deal with ibus service.""" -from __future__ import absolute_import from gi.repository import IBus, GLib import os @@ -93,7 +92,7 @@ def set_active_engines(engine_list): raise TypeError("engine_list must be a list of valid engine names.") available_engines = get_available_input_engines() for engine in engine_list: - if not isinstance(engine, basestring): + if not isinstance(engine, str): raise TypeError("Engines in engine_list must all be strings.") if engine not in available_engines: raise ValueError( diff --git a/tests/autopilot/unity/emulators/icons.py b/tests/autopilot/unity/emulators/icons.py index 8230194dc..15ac1713a 100644 --- a/tests/autopilot/unity/emulators/icons.py +++ b/tests/autopilot/unity/emulators/icons.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import from unity.emulators import UnityIntrospectionObject from unity.emulators.quicklist import Quicklist diff --git a/tests/autopilot/unity/emulators/launcher.py b/tests/autopilot/unity/emulators/launcher.py index f846f3c75..b95ec597e 100644 --- a/tests/autopilot/unity/emulators/launcher.py +++ b/tests/autopilot/unity/emulators/launcher.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import from autopilot.input import Mouse from autopilot.display import Display, move_mouse_to_screen @@ -136,7 +135,7 @@ class Launcher(UnityIntrospectionObject, KeybindingsHelper): found = False # Only try 10 times (5 secs.) before giving up. - for i in xrange(0, 10): + for i in range(0, 10): mouse_x = target_x = icon.center.x mouse_y = target_y = icon.center.y if target_y > h + y: @@ -225,7 +224,7 @@ class Launcher(UnityIntrospectionObject, KeybindingsHelper): continue logger.debug("Selected icon = %s", icon.tooltip_text) matches = True - for arg,val in kwargs.iteritems(): + for arg,val in kwargs.items(): if not hasattr(icon, arg) or getattr(icon, arg, None) != val: matches = False break diff --git a/tests/autopilot/unity/emulators/panel.py b/tests/autopilot/unity/emulators/panel.py index 78b10859d..71502f138 100644 --- a/tests/autopilot/unity/emulators/panel.py +++ b/tests/autopilot/unity/emulators/panel.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import import logging from time import sleep @@ -132,14 +131,14 @@ class UnityPanel(UnityIntrospectionObject, KeybindingsHelper): def get_active_indicator(self): """Returns the indicator entry that is currently active""" entries = self.get_indicator_entries(False, True) - entries = filter(lambda e: e.active == True, entries) + entries = [e for e in entries if e.active == True] assert(len(entries) <= 1) return entries[0] if entries else None def get_indicator_entry(self, entry_id): """Returns the indicator entry for the given ID or None""" entries = self.get_indicator_entries(False, True) - entries = filter(lambda e: e.entry_id == entry_id, entries) + entries = [e for e in entries if e.entry_id == entry_id] assert(len(entries) <= 1) return entries[0] if entries else None diff --git a/tests/autopilot/unity/emulators/quicklist.py b/tests/autopilot/unity/emulators/quicklist.py index 42601bd3d..bfb79385f 100644 --- a/tests/autopilot/unity/emulators/quicklist.py +++ b/tests/autopilot/unity/emulators/quicklist.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import import logging diff --git a/tests/autopilot/unity/emulators/screen.py b/tests/autopilot/unity/emulators/screen.py index b9299a2b6..c570178b2 100644 --- a/tests/autopilot/unity/emulators/screen.py +++ b/tests/autopilot/unity/emulators/screen.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import import logging from unity.emulators import UnityIntrospectionObject diff --git a/tests/autopilot/unity/emulators/shortcut_hint.py b/tests/autopilot/unity/emulators/shortcut_hint.py index 279b4f108..8448308a8 100644 --- a/tests/autopilot/unity/emulators/shortcut_hint.py +++ b/tests/autopilot/unity/emulators/shortcut_hint.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import import logging diff --git a/tests/autopilot/unity/emulators/switcher.py b/tests/autopilot/unity/emulators/switcher.py index 9bd9a256c..4b5df9bc1 100644 --- a/tests/autopilot/unity/emulators/switcher.py +++ b/tests/autopilot/unity/emulators/switcher.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import import logging @@ -152,7 +151,7 @@ class SwitcherController(UnityIntrospectionObject, KeybindingsHelper): for i in self.model.icons: current_icon = self.current_icon passed=True - for key,val in kwargs.iteritems(): + for key,val in kwargs.items(): if not hasattr(current_icon, key) or getattr(current_icon, key) != val: passed=False if passed: diff --git a/tests/autopilot/unity/emulators/tooltip.py b/tests/autopilot/unity/emulators/tooltip.py index 17c3740a3..6ab4f393c 100644 --- a/tests/autopilot/unity/emulators/tooltip.py +++ b/tests/autopilot/unity/emulators/tooltip.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import from unity.emulators import UnityIntrospectionObject diff --git a/tests/autopilot/unity/emulators/unity.py b/tests/autopilot/unity/emulators/unity.py index 22fdde19b..418ffa1c2 100644 --- a/tests/autopilot/unity/emulators/unity.py +++ b/tests/autopilot/unity/emulators/unity.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import from dbus import Interface, SessionBus diff --git a/tests/autopilot/unity/emulators/window_manager.py b/tests/autopilot/unity/emulators/window_manager.py index d07fec8ed..527046b8b 100644 --- a/tests/autopilot/unity/emulators/window_manager.py +++ b/tests/autopilot/unity/emulators/window_manager.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import import logging from autopilot.introspection.types import Rectangle diff --git a/tests/autopilot/unity/emulators/workspace.py b/tests/autopilot/unity/emulators/workspace.py index a13972c1b..ce929cf3d 100644 --- a/tests/autopilot/unity/emulators/workspace.py +++ b/tests/autopilot/unity/emulators/workspace.py @@ -7,7 +7,6 @@ # by the Free Software Foundation. # -from __future__ import absolute_import from autopilot.keybindings import KeybindingsHelper from autopilot.display import Display diff --git a/tests/autopilot/unity/tests/__init__.py b/tests/autopilot/unity/tests/__init__.py index da114f955..4c62c0968 100644 --- a/tests/autopilot/unity/tests/__init__.py +++ b/tests/autopilot/unity/tests/__init__.py @@ -8,7 +8,6 @@ """Autopilot test case class for Unity-specific tests.""" -from __future__ import absolute_import from codecs import open diff --git a/tests/autopilot/unity/tests/launcher/test_capture.py b/tests/autopilot/unity/tests/launcher/test_capture.py index 24da2a746..28d59c348 100644 --- a/tests/autopilot/unity/tests/launcher/test_capture.py +++ b/tests/autopilot/unity/tests/launcher/test_capture.py @@ -7,7 +7,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually import logging diff --git a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py index b51267dee..f8876ba43 100644 --- a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py +++ b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py @@ -7,7 +7,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from autopilot.testcase import multiply_scenarios diff --git a/tests/autopilot/unity/tests/launcher/test_keynav.py b/tests/autopilot/unity/tests/launcher/test_keynav.py index 85b2baded..57a9ccc1a 100644 --- a/tests/autopilot/unity/tests/launcher/test_keynav.py +++ b/tests/autopilot/unity/tests/launcher/test_keynav.py @@ -7,7 +7,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually import logging diff --git a/tests/autopilot/unity/tests/launcher/test_reveal.py b/tests/autopilot/unity/tests/launcher/test_reveal.py index 7d57f12b2..2bc6d22ee 100644 --- a/tests/autopilot/unity/tests/launcher/test_reveal.py +++ b/tests/autopilot/unity/tests/launcher/test_reveal.py @@ -7,7 +7,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.display import move_mouse_to_screen from autopilot.matchers import Eventually diff --git a/tests/autopilot/unity/tests/launcher/test_scroll.py b/tests/autopilot/unity/tests/launcher/test_scroll.py index 5e500c765..8dcac1954 100644 --- a/tests/autopilot/unity/tests/launcher/test_scroll.py +++ b/tests/autopilot/unity/tests/launcher/test_scroll.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually import logging diff --git a/tests/autopilot/unity/tests/launcher/test_shortcut.py b/tests/autopilot/unity/tests/launcher/test_shortcut.py index 28d661395..9aafc4f62 100644 --- a/tests/autopilot/unity/tests/launcher/test_shortcut.py +++ b/tests/autopilot/unity/tests/launcher/test_shortcut.py @@ -7,7 +7,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually import logging diff --git a/tests/autopilot/unity/tests/launcher/test_switcher.py b/tests/autopilot/unity/tests/launcher/test_switcher.py index 657cc2357..833c03edd 100644 --- a/tests/autopilot/unity/tests/launcher/test_switcher.py +++ b/tests/autopilot/unity/tests/launcher/test_switcher.py @@ -7,7 +7,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually diff --git a/tests/autopilot/unity/tests/launcher/test_visual.py b/tests/autopilot/unity/tests/launcher/test_visual.py index c44e9237d..262a2cb72 100644 --- a/tests/autopilot/unity/tests/launcher/test_visual.py +++ b/tests/autopilot/unity/tests/launcher/test_visual.py @@ -7,7 +7,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually import logging diff --git a/tests/autopilot/unity/tests/test_command_lens.py b/tests/autopilot/unity/tests/test_command_lens.py index acafc4983..4076c01e9 100644 --- a/tests/autopilot/unity/tests/test_command_lens.py +++ b/tests/autopilot/unity/tests/test_command_lens.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from testtools.matchers import Equals, NotEquals, GreaterThan, MatchesPredicate diff --git a/tests/autopilot/unity/tests/test_dash.py b/tests/autopilot/unity/tests/test_dash.py index 8f4943abc..c7b2106f6 100644 --- a/tests/autopilot/unity/tests/test_dash.py +++ b/tests/autopilot/unity/tests/test_dash.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.clipboard import get_clipboard_contents from autopilot.display import move_mouse_to_screen @@ -266,14 +265,14 @@ class DashMultiKeyTests(DashSearchInputTests): self.unity.dash.reveal_application_scope() self.keyboard.press_and_release('Multi_key') self.keyboard.type("^o") - self.assertSearchText(u'\xf4') + self.assertSearchText('\xf4') def test_multi_key_copyright(self): """Pressing the sequences 'Multi_key' + 'c' + 'o' must produce '©'.""" self.unity.dash.reveal_application_scope() self.keyboard.press_and_release('Multi_key') self.keyboard.type("oc") - self.assertSearchText(u'\xa9') + self.assertSearchText('\xa9') def test_multi_key_delete(self): """Pressing 'Multi_key' must not get stuck looking for a sequence.""" @@ -382,7 +381,7 @@ class DashKeyNavTests(DashTestCase): self.keyboard.release('Control') scopebar = self.unity.dash.view.get_scopebar() - self.assertEqual(scopebar.active_scope, u'applications.scope') + self.assertEqual(scopebar.active_scope, 'applications.scope') self.keyboard.press('Control') self.keyboard.press('Shift') @@ -722,7 +721,7 @@ class DashScopeBarTests(DashTestCase): """Scope selection should work when clicking in the rectangle outside of the icon. """ - app_icon = self.scopebar.get_icon_by_name(u'applications.scope') + app_icon = self.scopebar.get_icon_by_name('applications.scope') self.mouse.click_object(app_icon) self.assertThat(self.scopebar.active_scope, Eventually(Equals('applications.scope'))) diff --git a/tests/autopilot/unity/tests/test_gnome_key_grabber.py b/tests/autopilot/unity/tests/test_gnome_key_grabber.py index d7c49f60d..e0767b113 100644 --- a/tests/autopilot/unity/tests/test_gnome_key_grabber.py +++ b/tests/autopilot/unity/tests/test_gnome_key_grabber.py @@ -135,7 +135,7 @@ class GnomeKeyGrabberTests(unity.tests.UnityTestCase): self.check_accelerator(accelerator) def test_grab_same_accelerator(self): - accelerators = [Accelerator('<Shift><Control><Alt>b', 'Shift+Control+Alt+b') for i in xrange(3)] + accelerators = [Accelerator('<Shift><Control><Alt>b', 'Shift+Control+Alt+b') for i in range(3)] actions = self.interface.GrabAccelerators([(accelerator.accelerator, 0) for accelerator in accelerators]) self.activatable.clear() diff --git a/tests/autopilot/unity/tests/test_gobject_introspection.py b/tests/autopilot/unity/tests/test_gobject_introspection.py index 58a0c38ea..d1a7573a7 100755 --- a/tests/autopilot/unity/tests/test_gobject_introspection.py +++ b/tests/autopilot/unity/tests/test_gobject_introspection.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from testtools import TestCase diff --git a/tests/autopilot/unity/tests/test_home_lens.py b/tests/autopilot/unity/tests/test_home_lens.py index 4094d8487..f88066658 100644 --- a/tests/autopilot/unity/tests/test_home_lens.py +++ b/tests/autopilot/unity/tests/test_home_lens.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from testtools.matchers import Equals diff --git a/tests/autopilot/unity/tests/test_hud.py b/tests/autopilot/unity/tests/test_hud.py index 310ceb17f..719c7fd80 100644 --- a/tests/autopilot/unity/tests/test_hud.py +++ b/tests/autopilot/unity/tests/test_hud.py @@ -7,7 +7,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from autopilot.display import Display, move_mouse_to_screen, is_rect_on_screen @@ -230,7 +229,7 @@ class HudBehaviorTests(HudTestsBase): self.keyboard.type("save") - self.hud_query_check(u'Save\u2002(File)') + self.hud_query_check('Save\u2002(File)') self.keyboard.press_and_release('Return') self.addCleanup(self.keyboard.press_and_release, "Ctrl+s") @@ -338,7 +337,7 @@ class HudBehaviorTests(HudTestsBase): self.keyboard.type("Quit") self.assertThat(self.unity.hud.search_string, Eventually(Equals("Quit"))) - self.hud_query_check(u'Quit\u2002(File)') + self.hud_query_check('Quit\u2002(File)') self.keyboard.press_and_release("Enter") diff --git a/tests/autopilot/unity/tests/test_ibus.py b/tests/autopilot/unity/tests/test_ibus.py index 580e5b87f..5173dd7d6 100644 --- a/tests/autopilot/unity/tests/test_ibus.py +++ b/tests/autopilot/unity/tests/test_ibus.py @@ -8,7 +8,6 @@ """Tests to ensure unity is compatible with ibus input method.""" -from __future__ import absolute_import from unity.emulators.ibus import ( get_active_input_engines, @@ -85,7 +84,7 @@ class IBusQuery: timeout.start() while self._context.get_engine() is None: if self._abort is True: - print "Error! Could not set the engine correctly." + print ("Error! Could not set the engine correctly.") return None continue timeout.cancel() @@ -99,7 +98,7 @@ class IBusQuery: GLib.timeout_add_seconds(5, lambda *args: self._glibloop.quit()) self._glibloop.run() - return unicode(self.result, "UTF-8") + return str(self.result, "UTF-8") @@ -240,10 +239,10 @@ class IBusTestsPinyin(IBusWidgetScenariodTests): scenarios = multiply_scenarios( IBusWidgetScenariodTests.scenarios, [ - ('photo', {'input': 'zhaopian ', 'result' : u'\u7167\u7247' }), - ('internet', {'input': 'hulianwang ', 'result' : u'\u4e92\u8054\u7f51'}), - ('hello', {'input': 'ninhao ', 'result' : u'\u60a8\u597d' }), - ('management', {'input': 'guanli ', 'result' : u'\u7ba1\u7406' }), + ('photo', {'input': 'zhaopian ', 'result' : '\u7167\u7247' }), + ('internet', {'input': 'hulianwang ', 'result' : '\u4e92\u8054\u7f51'}), + ('hello', {'input': 'ninhao ', 'result' : '\u60a8\u597d' }), + ('management', {'input': 'guanli ', 'result' : '\u7ba1\u7406' }), ] ) @@ -263,9 +262,9 @@ class IBusTestsHangul(IBusWidgetScenariodTests): scenarios = multiply_scenarios( IBusWidgetScenariodTests.scenarios, [ - ('transmission', {'input': 'xmfostmaltus ', 'result': u'\ud2b8\ub79c\uc2a4\ubbf8\uc158 '}), - ('social', {'input': 'httuf ', 'result': u'\uc18c\uc15c '}), - ('document', {'input': 'anstj ', 'result': u'\ubb38\uc11c '}), + ('transmission', {'input': 'xmfostmaltus ', 'result': '\ud2b8\ub79c\uc2a4\ubbf8\uc158 '}), + ('social', {'input': 'httuf ', 'result': '\uc18c\uc15c '}), + ('document', {'input': 'anstj ', 'result': '\ubb38\uc11c '}), ] ) @@ -285,9 +284,9 @@ class IBusTestsAnthy(IBusWidgetScenariodTests): scenarios = multiply_scenarios( IBusWidgetScenariodTests.scenarios, [ - ('system', {'input': 'shisutemu ', 'result' : u'\u30b7\u30b9\u30c6\u30e0' }), - ('game', {'input': 'ge-mu ', 'result' : u'\u30b2\u30fc\u30e0' }), - ('user', {'input': 'yu-za- ', 'result' : u'\u30e6\u30fc\u30b6\u30fc' }), + ('system', {'input': 'shisutemu ', 'result' : '\u30b7\u30b9\u30c6\u30e0' }), + ('game', {'input': 'ge-mu ', 'result' : '\u30b2\u30fc\u30e0' }), + ('user', {'input': 'yu-za- ', 'result' : '\u30e6\u30fc\u30b6\u30fc' }), ], [ ('commit_enter', {'commit_key': 'Enter'}), diff --git a/tests/autopilot/unity/tests/test_panel.py b/tests/autopilot/unity/tests/test_panel.py index 634fd9347..d2119ab24 100644 --- a/tests/autopilot/unity/tests/test_panel.py +++ b/tests/autopilot/unity/tests/test_panel.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.display import Display #from autopilot.emulators.bamf import BamfWindow diff --git a/tests/autopilot/unity/tests/test_quicklist.py b/tests/autopilot/unity/tests/test_quicklist.py index a6a197196..32c356674 100644 --- a/tests/autopilot/unity/tests/test_quicklist.py +++ b/tests/autopilot/unity/tests/test_quicklist.py @@ -7,7 +7,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.display import move_mouse_to_screen from autopilot.matchers import Eventually diff --git a/tests/autopilot/unity/tests/test_search.py b/tests/autopilot/unity/tests/test_search.py index 87d038bc0..d7297b147 100644 --- a/tests/autopilot/unity/tests/test_search.py +++ b/tests/autopilot/unity/tests/test_search.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from testtools.matchers import ( diff --git a/tests/autopilot/unity/tests/test_shopping_lens.py b/tests/autopilot/unity/tests/test_shopping_lens.py index 94a435dbc..8f7bcb1a3 100644 --- a/tests/autopilot/unity/tests/test_shopping_lens.py +++ b/tests/autopilot/unity/tests/test_shopping_lens.py @@ -6,12 +6,11 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from testtools.matchers import Equals, GreaterThan from time import sleep -import urllib2 +import urllib.request, urllib.error, urllib.parse import gettext from unity.tests import UnityTestCase @@ -23,8 +22,8 @@ class ShoppingScopeTests(UnityTestCase): def setUp(self): super(ShoppingScopeTests, self).setUp() try: - urllib2.urlopen("http://www.google.com", timeout=2) - except urllib2.URLError, e: + urllib.request.urlopen("http://www.google.com", timeout=2) + except urllib.error.URLError as e: self.skip("Skipping test, no internet connection") gettext.install("unity-scope-shopping") diff --git a/tests/autopilot/unity/tests/test_shortcut_hint.py b/tests/autopilot/unity/tests/test_shortcut_hint.py index 0320516a7..899c77ada 100644 --- a/tests/autopilot/unity/tests/test_shortcut_hint.py +++ b/tests/autopilot/unity/tests/test_shortcut_hint.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from testtools.matchers import Equals diff --git a/tests/autopilot/unity/tests/test_showdesktop.py b/tests/autopilot/unity/tests/test_showdesktop.py index 546b716f2..ce00894e4 100644 --- a/tests/autopilot/unity/tests/test_showdesktop.py +++ b/tests/autopilot/unity/tests/test_showdesktop.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from testtools.matchers import Equals diff --git a/tests/autopilot/unity/tests/test_spread.py b/tests/autopilot/unity/tests/test_spread.py index 0cc91a10e..961ac1e79 100644 --- a/tests/autopilot/unity/tests/test_spread.py +++ b/tests/autopilot/unity/tests/test_spread.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.display import Display from autopilot.matchers import Eventually diff --git a/tests/autopilot/unity/tests/test_switcher.py b/tests/autopilot/unity/tests/test_switcher.py index d302db10f..38d7985c4 100644 --- a/tests/autopilot/unity/tests/test_switcher.py +++ b/tests/autopilot/unity/tests/test_switcher.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.display import move_mouse_to_screen from autopilot.matchers import Eventually diff --git a/tests/autopilot/unity/tests/test_unity_logging.py b/tests/autopilot/unity/tests/test_unity_logging.py index 0aa88440a..4b106b744 100644 --- a/tests/autopilot/unity/tests/test_unity_logging.py +++ b/tests/autopilot/unity/tests/test_unity_logging.py @@ -6,8 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import - from os import remove from os.path import exists from tempfile import mktemp diff --git a/tests/autopilot/unity/tests/test_wm_keybindings.py b/tests/autopilot/unity/tests/test_wm_keybindings.py index fe5418d6a..89390bb40 100644 --- a/tests/autopilot/unity/tests/test_wm_keybindings.py +++ b/tests/autopilot/unity/tests/test_wm_keybindings.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from testtools.matchers import Equals, NotEquals, GreaterThan diff --git a/tests/autopilot/unity/tests/xim/test_gcin.py b/tests/autopilot/unity/tests/xim/test_gcin.py index 81420cd86..7f0cda1b8 100644 --- a/tests/autopilot/unity/tests/xim/test_gcin.py +++ b/tests/autopilot/unity/tests/xim/test_gcin.py @@ -6,7 +6,6 @@ # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -from __future__ import absolute_import from autopilot.matchers import Eventually from os import environ @@ -34,9 +33,9 @@ class GcinTestHangul(GcinTestCase): """Tests the Dash and Hud with gcin in hangul mode.""" scenarios = [ - ('hangul', {'input': 'han geul ', 'result': u'\ud55c\uae00'}), - ('morning letters', {'input': 'a chimgeul ', 'result': u'\uc544\uce68\uae00'}), - ('national script', {'input': 'gug mun ', 'result': u'\uad6d\ubb38'}), + ('hangul', {'input': 'han geul ', 'result': '\ud55c\uae00'}), + ('morning letters', {'input': 'a chimgeul ', 'result': '\uc544\uce68\uae00'}), + ('national script', {'input': 'gug mun ', 'result': '\uad6d\ubb38'}), ] def setUp(self): diff --git a/tools/makebootchart.py b/tools/makebootchart.py index 891549470..15e941aee 100755 --- a/tools/makebootchart.py +++ b/tools/makebootchart.py @@ -76,7 +76,7 @@ def draw_bg_graph (ctx, seconds, height): ctx.stroke () per_ten = 0 - for pos in xrange (0, int(total_width), int (0.01 * width_multiplier)): + for pos in range (0, int(total_width), int (0.01 * width_multiplier)): ctx.set_line_width (1) ctx.set_source_rgba (0.0, 0.0, 0.0, 0.10) @@ -156,7 +156,7 @@ def build_graph (data, filename, info): def build_data_structure (input): reader = csv.reader(open(input)) structure = [] - print "reading", input + print("reading", input) for row in reader: name = row[0] start = float(row[1]) @@ -168,15 +168,15 @@ def build_data_structure (input): def usage(): - print "use --input=filename.log and --output=filename.svg :)" + print("use --input=filename.log and --output=filename.svg :)") def main(): try: opts, args = getopt.getopt(sys.argv[1:], "h", ["help", "output=", "input="]) - except getopt.GetoptError, err: + except getopt.GetoptError as err: # print help information and exit: - print str(err) # will print something like "option -a not recognized" + print(str(err)) # will print something like "option -a not recognized" usage() sys.exit(2) diff --git a/tools/unity-introspection-visualiser.py b/tools/unity-introspection-visualiser.py index c56b241fb..a30c67e25 100755 --- a/tools/unity-introspection-visualiser.py +++ b/tools/unity-introspection-visualiser.py @@ -9,16 +9,16 @@ import dbus try: from autopilot.emulators.unity import get_state_by_path -except ImportError, e: - print "Error: could not import the autopilot python module." - print "Make sure the autopilot module is in your $PYTHONPATH." +except ImportError as e: + print("Error: could not import the autopilot python module.") + print("Make sure the autopilot module is in your $PYTHONPATH.") exit(1) try: import pydot except ImportError: - print "Error: the 'pydot' module is required to run this script." - print "Try installing the 'python-pydot' package." + print("Error: the 'pydot' module is required to run this script.") + print("Try installing the 'python3-pydot' package.") exit(1) NEXT_NODE_ID=1 @@ -53,7 +53,7 @@ def traverse_tree(state, parent, graph): bits = ["%s=%s" % (k, string_rep(state[k])) for k in sorted(state.keys()) if k != 'Children'] lbl += "\l".join(bits) parent.set_label(escape('"{' + lbl + '}"')) - if state.has_key('Children'): + if 'Children' in state: # Add all array nodes as children of this node. for child_name, child_state in state['Children']: if child_name in NODE_BLACKLIST: @@ -94,7 +94,7 @@ if __name__ == '__main__': if hasattr(graph, write_method_name): getattr(graph, write_method_name)(args.output[0]) else: - print "Error: unsupported format: '%s'" % (extension) + print("Error: unsupported format: '%s'" % (extension)) elif args.display: from tempfile import NamedTemporaryFile from subprocess import call @@ -104,6 +104,6 @@ if __name__ == '__main__': call(["eog", tf.name]) remove(tf.name) else: - print 'unknown output mode!' + print('unknown output mode!') |
