on xenial help sign in
Removed the py2 support.
commit5ec99b3cf226660f17b41f657151237ca73b60e2 authorLeo Arias <leo.arias@canonical.com> dateMon 23 Feb 2015, 11:29 (12 years ago) parentf84db1b
21 files changed+44−91
CODING+5−5 cmake/modules/autopilot.cmake−8 debian/control−5 debian/rules+2−2 tests/autopilot/unity8/application_lifecycle/tests/__init__.py+2−2 tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+2−4 tests/autopilot/unity8/application_lifecycle/tests/test_url_dispatcher.py+2−2 tests/autopilot/unity8/fixture_setup.py+4−4 tests/autopilot/unity8/indicators/__init__.py+1−1 tests/autopilot/unity8/indicators/tests/__init__.py+1−1 tests/autopilot/unity8/indicators/tests/test_indicators.py+2−4 tests/autopilot/unity8/process_helpers.py+2−9 tests/autopilot/unity8/shell/emulators/create_interactive_notification.py+2−3 tests/autopilot/unity8/shell/emulators/dash.py+3−3 tests/autopilot/unity8/shell/fixture_setup.py+2−2 tests/autopilot/unity8/shell/tests/__init__.py+3−3 tests/autopilot/unity8/shell/tests/test_emulators.py+4−4 tests/autopilot/unity8/shell/tests/test_lock_screen.py+1−9 tests/autopilot/unity8/shell/tests/test_notifications.py+3−11 tests/autopilot/unity8/shell/tests/test_tutorial.py+2−2 tests/autopilot/unity8/shell/tests/test_upstart.py+1−7
CODING+5−5
@@ -24,7 +24,7 @@ $ ./build.sh --setup
2424
2525 this will:
2626 - install the required dependencies to build, as well as run on the desktop
27− - it should also install unity-scope-home and unity-lens-application which
27+ - it should also install unity-scope-home and unity-lens-application which
2828 are technically "recommends", not strict dependencies
2929
3030build Unity 8
@@ -104,8 +104,8 @@ Notes
104104 - it's unsafe - anyone can connect to your device
105105 - with TCP the Nexus 10 doesn't drop the adb connection when locking
106106 the screen
107−- exporting ANDROID_SERIAL=$your_device_serial or
108− ANDROID_SERIAL=$your_device_ip:5555 will make adb not complain about
107+- exporting ANDROID_SERIAL=$your_device_serial or
108+ ANDROID_SERIAL=$your_device_ip:5555 will make adb not complain about
109109 multiple devices
110110- you can export TARGET_IP=$your_device_ip TARGET_SSH_PORT=22 for run_on_device.sh
111111 to not use adb forwarding - useful if you use multiple devices
@@ -190,8 +190,8 @@ $ PYTHONPATH=../tests/autopilot autopilot list unity8
190190
191191And then run a single test with
192192
193−$ PYTHONPATH=../tests/autopilot autopilot run unity8.some.very.long.test.name
193+$ PYTHONPATH=../tests/autopilot autopilot3 run unity8.some.very.long.test.name
194194
195195or run them all with
196196
197−$ PYTHONPATH=../tests/autopilot autopilot run unity8
197+$ PYTHONPATH=../tests/autopilot autopilot3 run unity8
cmake/modules/autopilot.cmake−8
@@ -13,12 +13,4 @@ function(declare_autopilot_test TEST_NAME TEST_SUITE WORKING_DIR)
1313
1414 add_dependencies(autopilot autopilot-${TEST_NAME})
1515
16− add_custom_target(autopilot2-${TEST_NAME}
17− COMMAND UNITY_TESTING=1 LANG=C QML2_IMPORT_PATH=${SHELL_INSTALL_QML}/mocks python2 -m autopilot.run run ${TEST_SUITE}
18− WORKING_DIRECTORY ${WORKING_DIR}
19− DEPENDS fake_install
20− )
21−
22− add_dependencies(autopilot autopilot2-${TEST_NAME})
23−
2416endfunction()
debian/control−5
@@ -144,11 +144,6 @@ Depends: gir1.2-glib-2.0,
144144 libautopilot-qt (>= 1.4),
145145 libqt5test5,
146146 libqt5widgets5,
147− python-autopilot,
148− python-evdev,
149− python-fixtures,
150− python-gi,
151− python-mock,
152147 python3-autopilot,
153148 python3-evdev,
154149 python3-fixtures,
debian/rules+2−2
@@ -14,7 +14,7 @@ export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.9
1414export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9
1515
1616%:
17− dh $@ --parallel --fail-missing --with python2,python3
17+ dh $@ --parallel --fail-missing --with python3
1818
1919override_dh_auto_clean:
2020 dh_auto_clean
@@ -32,7 +32,7 @@ override_dh_auto_build:
3232override_dh_install:
3333 # install autopilot tests
3434 cd tests/autopilot; \
35− set -ex; for python in $(shell pyversions -r) $(shell py3versions -r); do \
35+ set -ex; for python in $(shell py3versions -r); do \
3636 $$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
3737 done; \
3838 cd $(CURDIR)
tests/autopilot/unity8/application_lifecycle/tests/__init__.py+2−2
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ from unity8.shell import tests
2828class ApplicationLifeCycleTestCase(tests.UnityTestCase):
2929
3030 def setUp(self):
31− super(ApplicationLifeCycleTestCase, self).setUp()
31+ super().setUp()
3232 self._qml_mock_enabled = False
3333 self._data_dirs_mock_enabled = False
3434 unity_proxy = self.launch_unity()
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+2−4
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2013, 2014 Canonical
4+# Copyright (C) 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -19,8 +19,6 @@
1919
2020"""Tests for the application lifecycle."""
2121
22−from __future__ import absolute_import
23−
2422import logging
2523import os
2624
@@ -40,7 +38,7 @@ class ApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
4038 def setUp(self):
4139 if model() == 'Desktop':
4240 self.skipTest('Test cannot be run on the desktop.')
43− super(ApplicationLifecycleTests, self).setUp()
41+ super().setUp()
4442
4543 def swipe_screen_from_right(self):
4644 width = self.main_window.width
tests/autopilot/unity8/application_lifecycle/tests/test_url_dispatcher.py+2−2
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ class URLDispatcherTestCase(tests.ApplicationLifeCycleTestCase):
3232 def setUp(self):
3333 if platform.model() == 'Desktop':
3434 self.skipTest("URL dispatcher doesn't work on the desktop.")
35− super(URLDispatcherTestCase, self).setUp()
35+ super().setUp()
3636
3737 def test_swipe_out_application_started_by_url_dispatcher(self):
3838 _, desktop_file_path = self.create_test_application()
tests/autopilot/unity8/fixture_setup.py+4−4
@@ -38,13 +38,13 @@ class LaunchDashApp(fixtures.Fixture):
3838 :type variables: A dictionary.
3939
4040 """
41− super(LaunchDashApp, self).__init__()
41+ super().__init__()
4242 self.binary_path = binary_path
4343 self.variables = variables
4444
4545 def setUp(self):
4646 """Launch the dash app when the fixture is used."""
47− super(LaunchDashApp, self).setUp()
47+ super().setUp()
4848 self.addCleanup(self.stop_application)
4949 self.application_proxy = self.launch_application()
5050
@@ -69,11 +69,11 @@ class LaunchDashApp(fixtures.Fixture):
6969class DisplayRotationLock(fixtures.Fixture):
7070
7171 def __init__(self, enable):
72− super(DisplayRotationLock, self).__init__()
72+ super().__init__()
7373 self.enable = enable
7474
7575 def setUp(self):
76− super(DisplayRotationLock, self).setUp()
76+ super().setUp()
7777 original_state = self._is_rotation_lock_enabled()
7878 if self.enable != original_state:
7979 self.addCleanup(self._set_rotation_lock, original_state)
tests/autopilot/unity8/indicators/__init__.py+1−1
@@ -34,7 +34,7 @@ class IndicatorPage(emulators.UnityEmulatorBase):
3434 return False
3535
3636
37−class DisplayIndicator(object):
37+class DisplayIndicator():
3838
3939 def __init__(self, main_window):
4040 self._main_window = main_window
tests/autopilot/unity8/indicators/tests/__init__.py+1−1
@@ -29,6 +29,6 @@ class IndicatorTestCase(tests.UnityTestCase):
2929 def setUp(self):
3030 if platform.model() == 'Desktop':
3131 self.skipTest('Test cannot be run on the desktop.')
32− super(IndicatorTestCase, self).setUp()
32+ super().setUp()
3333 self.unity_proxy = self.launch_unity()
3434 process_helpers.unlock_unity(self.unity_proxy)
tests/autopilot/unity8/indicators/tests/test_indicators.py+2−4
@@ -16,8 +16,6 @@
1616# You should have received a copy of the GNU General Public License
1717# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
19−from __future__ import absolute_import
20−
2119from testscenarios import multiply_scenarios
2220
2321from autopilot import platform
@@ -42,7 +40,7 @@ class IndicatorExistsTestCase(tests.IndicatorTestCase):
4240 )
4341
4442 def setUp(self):
45− super(IndicatorExistsTestCase, self).setUp()
43+ super().setUp()
4644 if (platform.model() == 'Nexus 10' and
4745 self.indicator_name == 'indicator-bluetooth'):
4846 self.skipTest('Nexus 10 does not have bluetooth at the moment.')
@@ -77,7 +75,7 @@ class IndicatorPageTitleMatchesWidgetTestCase(tests.IndicatorTestCase):
7775 )
7876
7977 def setUp(self):
80− super(IndicatorPageTitleMatchesWidgetTestCase, self).setUp()
78+ super().setUp()
8179 if (platform.model() == 'Nexus 10' and
8280 self.indicator_name == 'indicator-bluetooth'):
8381 self.skipTest('Nexus 10 does not have bluetooth at the moment.')
tests/autopilot/unity8/process_helpers.py+2−9
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Utilities
4−# Copyright (C) 2013, 2014 Canonical
4+# Copyright (C) 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -19,16 +19,9 @@
1919
2020import logging
2121import subprocess
22−import sys
2322import dbus
2423
25−# This has to work in both python 3 (ap 1.5) and py2 (ap legacy 1.4.1) so we
26−# pick the correct location in each case. Remove the py2 branch once we no
27−# longer need to support python 2.
28−if sys.version >= '3':
29− from autopilot.exceptions import ProcessSearchError
30−else:
31− from autopilot.introspection import ProcessSearchError
24+from autopilot.exceptions import ProcessSearchError
3225from autopilot.introspection import get_proxy_object_for_existing_process
3326
3427from unity8.shell import emulators
tests/autopilot/unity8/shell/emulators/create_interactive_notification.py+2−3
@@ -1,10 +1,9 @@
1−#!/usr/bin/env python
2−from __future__ import print_function
1+#!/usr/bin/env python3
32
43# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
54#
65# Unity Autopilot Test Suite
7−# Copyright (C) 2012-2013 Canonical
6+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
87#
98# This program is free software: you can redistribute it and/or modify
109# it under the terms of the GNU General Public License as published by
tests/autopilot/unity8/shell/emulators/dash.py+3−3
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2012, 2013, 2014 Canonical
4+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ from ubuntuuitoolkit import emulators as toolkit_emulators
3030logger = logging.getLogger(__name__)
3131
3232
33−class DashApp(object):
33+class DashApp():
3434
3535 """Autopilot helper for the Dash app."""
3636
@@ -45,7 +45,7 @@ class Dash(emulators.UnityEmulatorBase):
4545 """An emulator that understands the Dash."""
4646
4747 def __init__(self, *args):
48− super(Dash, self).__init__(*args)
48+ super().__init__(*args)
4949 self.dash_content_list = self.wait_select_single(
5050 'QQuickListView', objectName='dashContentList')
5151
tests/autopilot/unity8/shell/fixture_setup.py+2−2
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ import unity8
3131class FakeScopes(fixtures.Fixture):
3232
3333 def setUp(self):
34− super(FakeScopes, self).setUp()
34+ super().setUp()
3535 self.useFixture(
3636 fixtures.EnvironmentVariable(
3737 'QML2_IMPORT_PATH',
tests/autopilot/unity8/shell/tests/__init__.py+3−3
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2012, 2013, 2014 Canonical
4+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -148,7 +148,7 @@ class UnityTestCase(AutopilotTestCase):
148148 sys.exit(2)
149149
150150 def setUp(self):
151− super(UnityTestCase, self).setUp()
151+ super().setUp()
152152 if is_unity7_running():
153153 self.useFixture(toolkit_fixtures.HideUnity7Launcher())
154154
@@ -400,7 +400,7 @@ class DashBaseTestCase(AutopilotTestCase):
400400 environment = {}
401401
402402 def setUp(self):
403− super(DashBaseTestCase, self).setUp()
403+ super().setUp()
404404
405405 if is_unity7_running():
406406 self.useFixture(toolkit_fixtures.HideUnity7Launcher())
tests/autopilot/unity8/shell/tests/test_emulators.py+4−4
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ class MainWindowTestCase(tests.UnityTestCase):
3838 scenarios = tests._get_device_emulation_scenarios()
3939
4040 def setUp(self):
41− super(MainWindowTestCase, self).setUp()
41+ super().setUp()
4242 unity_proxy = self.launch_unity()
4343 process_helpers.unlock_unity(unity_proxy)
4444
@@ -110,7 +110,7 @@ class GenericScopeViewEmulatorTestCase(tests.DashBaseTestCase):
110110 def setUp(self):
111111 # Set up the fake scopes before launching unity.
112112 self.useFixture(fixture_setup.FakeScopes())
113− super(GenericScopeViewEmulatorTestCase, self).setUp()
113+ super().setUp()
114114 self.generic_scope = self.dash.open_scope('MockScope1')
115115
116116 def test_open_preview(self):
@@ -129,7 +129,7 @@ class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
129129 def setUp(self):
130130 # Set up the fake scopes before launching unity.
131131 self.useFixture(fixture_setup.FakeScopes())
132− super(DashAppsEmulatorTestCase, self).setUp()
132+ super().setUp()
133133 self.applications_scope = self.dash.open_scope('clickscope')
134134
135135 def test_get_applications_should_return_correct_applications(self):
tests/autopilot/unity8/shell/tests/test_lock_screen.py+1−9
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2012, 2013, 2014 Canonical
4+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -17,22 +17,14 @@
1717# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818#
1919
20−
21−from __future__ import absolute_import
22−
2320from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2421
2522from autopilot.matchers import Eventually
26−import sys
2723from testtools.matchers import Equals
2824import logging
2925
3026logger = logging.getLogger(__name__)
3127
32−# py2 compatible alias for py3
33−if sys.version >= '3':
34− basestring = str
35−
3628
3729class TestLockscreen(UnityTestCase):
3830
tests/autopilot/unity8/shell/tests/test_notifications.py+3−11
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2012, 2013, 2014 Canonical
4+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -19,8 +19,6 @@
1919
2020"""Tests for Notifications"""
2121
22−from __future__ import absolute_import
23−
2422from unity8 import shell
2523from unity8.process_helpers import unlock_unity
2624from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
@@ -34,15 +32,9 @@ import os
3432import logging
3533import signal
3634import subprocess
37−import sys
3835
3936logger = logging.getLogger(__name__)
4037
41−# from __future__ import range
42−# (python3's range, is same as python2's xrange)
43−if sys.version_info < (3,):
44− range = xrange
45−
4638
4739class NotificationsBase(UnityTestCase):
4840 """Base class for all notification tests that provides helper methods."""
@@ -118,7 +110,7 @@ class InteractiveNotificationBase(NotificationsBase):
118110 """Collection of test for Interactive tests including snap decisions."""
119111
120112 def setUp(self):
121− super(InteractiveNotificationBase, self).setUp()
113+ super().setUp()
122114 # Need to keep track when we launch the notification script.
123115 self._notify_proc = None
124116
@@ -410,7 +402,7 @@ class EphemeralNotificationsTests(NotificationsBase):
410402 """Collection of tests for Emphemeral notifications (non-interactive.)"""
411403
412404 def setUp(self):
413− super(EphemeralNotificationsTests, self).setUp()
405+ super().setUp()
414406 # Because we are using the Notify library we need to init and un-init
415407 # otherwise we get crashes.
416408 Notify.init("Autopilot Ephemeral Notification Tests")
tests/autopilot/unity8/shell/tests/test_tutorial.py+2−2
@@ -1,7 +1,7 @@
11# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
22#
33# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
55#
66# This program is free software: you can redistribute it and/or modify
77# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ from unity8.shell.emulators import tutorial # NOQA
3131class TutorialTestCase(tests.UnityTestCase):
3232
3333 def setUp(self):
34− super(TutorialTestCase, self).setUp()
34+ super().setUp()
3535 self._qml_mock_enabled = False
3636 self._data_dirs_mock_enabled = False
3737
tests/autopilot/unity8/shell/tests/test_upstart.py+1−7
@@ -38,12 +38,6 @@ import logging
3838
3939logger = logging.getLogger(__name__)
4040
41−# from __future__ import range
42−# (python3's range, is same as python2's xrange)
43−import sys
44−if sys.version_info < (3,):
45− range = xrange
46−
4741
4842class UpstartIntegrationTests(UnityTestCase):
4943
@@ -95,7 +89,7 @@ class UpstartIntegrationTests(UnityTestCase):
9589 self.addCleanup(ensure_stopped)
9690
9791 def _set_proxy(self):
98− super(UpstartIntegrationTests, self)._set_proxy(
92+ super()._set_proxy(
9993 get_proxy_object_for_existing_process(
10094 pid=self.process.pid,
10195 emulator_base=UnityEmulatorBase,))