on xenial help sign in
Drop the support for python2 in autopilot tests. Fixes: #1429163
080d8e7Leo Arias
CODING+5−5
@@ -24,7 +24,7 @@ $ ./build.sh --setup
24
24
25 this will:
25 this will:
26 - install the required dependencies to build, as well as run on the desktop
26 - 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
28 are technically "recommends", not strict dependencies
28 are technically "recommends", not strict dependencies
29
29
30build Unity 8
30build Unity 8
@@ -104,8 +104,8 @@ Notes
104 - it's unsafe - anyone can connect to your device
104 - it's unsafe - anyone can connect to your device
105 - with TCP the Nexus 10 doesn't drop the adb connection when locking
105 - with TCP the Nexus 10 doesn't drop the adb connection when locking
106 the screen
106 the screen
107−- exporting ANDROID_SERIAL=$your_device_serial or
107+- exporting ANDROID_SERIAL=$your_device_serial or
108− ANDROID_SERIAL=$your_device_ip:5555 will make adb not complain about
108+ ANDROID_SERIAL=$your_device_ip:5555 will make adb not complain about
109 multiple devices
109 multiple devices
110- you can export TARGET_IP=$your_device_ip TARGET_SSH_PORT=22 for run_on_device.sh
110- you can export TARGET_IP=$your_device_ip TARGET_SSH_PORT=22 for run_on_device.sh
111 to not use adb forwarding - useful if you use multiple devices
111 to not use adb forwarding - useful if you use multiple devices
@@ -190,8 +190,8 @@ $ PYTHONPATH=../tests/autopilot autopilot list unity8
190
190
191And then run a single test with
191And then run a single test with
192
192
193−$ PYTHONPATH=../tests/autopilot autopilot run unity8.some.very.long.test.name
193+$ PYTHONPATH=../tests/autopilot autopilot3 run unity8.some.very.long.test.name
194
194
195or run them all with
195or run them all with
196
196
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)
13
13
14 add_dependencies(autopilot autopilot-${TEST_NAME})
14 add_dependencies(autopilot autopilot-${TEST_NAME})
15
15
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−
24endfunction()
16endfunction()
debian/control−8
@@ -31,10 +31,8 @@ Build-Depends: cmake,
31 libusermetricsoutput1-dev,
31 libusermetricsoutput1-dev,
32 libxcb1-dev,
32 libxcb1-dev,
33 pkg-config,
33 pkg-config,
34− python-setuptools,
35 python3-all:any,
34 python3-all:any,
36 python3-setuptools,
35 python3-setuptools,
37− python:any (>= 2.7),
38 qml-module-qt-labs-folderlistmodel,
36 qml-module-qt-labs-folderlistmodel,
39 qml-module-qtquick-layouts,
37 qml-module-qtquick-layouts,
40 qml-module-qtquick-xmllistmodel,
38 qml-module-qtquick-xmllistmodel,
@@ -147,11 +145,6 @@ Depends: gir1.2-glib-2.0,
147 libautopilot-qt (>= 1.4),
145 libautopilot-qt (>= 1.4),
148 libqt5test5,
146 libqt5test5,
149 libqt5widgets5,
147 libqt5widgets5,
150− python-autopilot,
151− python-evdev,
152− python-fixtures,
153− python-gi,
154− python-mock,
155 python3-autopilot,
148 python3-autopilot,
156 python3-evdev,
149 python3-evdev,
157 python3-fixtures,
150 python3-fixtures,
@@ -163,7 +156,6 @@ Depends: gir1.2-glib-2.0,
163 url-dispatcher-tools,
156 url-dispatcher-tools,
164 ${misc:Depends},
157 ${misc:Depends},
165 ${python3:Depends},
158 ${python3:Depends},
166− ${python:Depends},
167 ${shlibs:Depends},
159 ${shlibs:Depends},
168Description: Test package for Unity 8 shell
160Description: Test package for Unity 8 shell
169 Autopilot tests for the unity8 package
161 Autopilot tests for the unity8 package
debian/rules+2−2
@@ -14,7 +14,7 @@ export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.9
14export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9
14export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9
15
15
16%:
16%:
17− dh $@ --parallel --fail-missing --with python2,python3
17+ dh $@ --parallel --fail-missing --with python3
18
18
19override_dh_auto_clean:
19override_dh_auto_clean:
20 dh_auto_clean
20 dh_auto_clean
@@ -32,7 +32,7 @@ override_dh_auto_build:
32override_dh_install:
32override_dh_install:
33 # install autopilot tests
33 # install autopilot tests
34 cd tests/autopilot; \
34 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 \
36 $$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
36 $$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
37 done; \
37 done; \
38 cd $(CURDIR)
38 cd $(CURDIR)
tests/autopilot/setup.py+2−2
@@ -1,8 +1,8 @@
1−#!/usr/bin/python
1+#!/usr/bin/python3
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3#
3#
4# Unity Autopilot Test Suite
4# Unity Autopilot Test Suite
5−# Copyright (C) 2012-2013 Canonical
5+# Copyright (C) 2012, 2013, 2015 Canonical
6#
6#
7# This program is free software: you can redistribute it and/or modify
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
8# it under the terms of the GNU General Public License as published by
tests/autopilot/unity8/application_lifecycle/tests/__init__.py+2−2
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ from unity8.shell import tests
28class ApplicationLifeCycleTestCase(tests.UnityTestCase):
28class ApplicationLifeCycleTestCase(tests.UnityTestCase):
29
29
30 def setUp(self):
30 def setUp(self):
31− super(ApplicationLifeCycleTestCase, self).setUp()
31+ super().setUp()
32 self._qml_mock_enabled = False
32 self._qml_mock_enabled = False
33 self._data_dirs_mock_enabled = False
33 self._data_dirs_mock_enabled = False
34 unity_proxy = self.launch_unity()
34 unity_proxy = self.launch_unity()
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+2−4
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2013, 2014 Canonical
4+# Copyright (C) 2013, 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -19,8 +19,6 @@
19
19
20"""Tests for the application lifecycle."""
20"""Tests for the application lifecycle."""
21
21
22−from __future__ import absolute_import
23−
24import logging
22import logging
25import os
23import os
26
24
@@ -40,7 +38,7 @@ class ApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
40 def setUp(self):
38 def setUp(self):
41 if model() == 'Desktop':
39 if model() == 'Desktop':
42 self.skipTest('Test cannot be run on the desktop.')
40 self.skipTest('Test cannot be run on the desktop.')
43− super(ApplicationLifecycleTests, self).setUp()
41+ super().setUp()
44
42
45 def swipe_screen_from_right(self):
43 def swipe_screen_from_right(self):
46 width = self.main_window.width
44 width = self.main_window.width
tests/autopilot/unity8/application_lifecycle/tests/test_url_dispatcher.py+2−2
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ class URLDispatcherTestCase(tests.ApplicationLifeCycleTestCase):
32 def setUp(self):
32 def setUp(self):
33 if platform.model() == 'Desktop':
33 if platform.model() == 'Desktop':
34 self.skipTest("URL dispatcher doesn't work on the desktop.")
34 self.skipTest("URL dispatcher doesn't work on the desktop.")
35− super(URLDispatcherTestCase, self).setUp()
35+ super().setUp()
36
36
37 def test_swipe_out_application_started_by_url_dispatcher(self):
37 def test_swipe_out_application_started_by_url_dispatcher(self):
38 _, desktop_file_path = self.create_test_application()
38 _, desktop_file_path = self.create_test_application()
tests/autopilot/unity8/fixture_setup.py+4−4
@@ -38,13 +38,13 @@ class LaunchDashApp(fixtures.Fixture):
38 :type variables: A dictionary.
38 :type variables: A dictionary.
39
39
40 """
40 """
41− super(LaunchDashApp, self).__init__()
41+ super().__init__()
42 self.binary_path = binary_path
42 self.binary_path = binary_path
43 self.variables = variables
43 self.variables = variables
44
44
45 def setUp(self):
45 def setUp(self):
46 """Launch the dash app when the fixture is used."""
46 """Launch the dash app when the fixture is used."""
47− super(LaunchDashApp, self).setUp()
47+ super().setUp()
48 self.addCleanup(self.stop_application)
48 self.addCleanup(self.stop_application)
49 self.application_proxy = self.launch_application()
49 self.application_proxy = self.launch_application()
50
50
@@ -69,11 +69,11 @@ class LaunchDashApp(fixtures.Fixture):
69class DisplayRotationLock(fixtures.Fixture):
69class DisplayRotationLock(fixtures.Fixture):
70
70
71 def __init__(self, enable):
71 def __init__(self, enable):
72− super(DisplayRotationLock, self).__init__()
72+ super().__init__()
73 self.enable = enable
73 self.enable = enable
74
74
75 def setUp(self):
75 def setUp(self):
76− super(DisplayRotationLock, self).setUp()
76+ super().setUp()
77 original_state = self._is_rotation_lock_enabled()
77 original_state = self._is_rotation_lock_enabled()
78 if self.enable != original_state:
78 if self.enable != original_state:
79 self.addCleanup(self._set_rotation_lock, original_state)
79 self.addCleanup(self._set_rotation_lock, original_state)
tests/autopilot/unity8/indicators/__init__.py+1−1
@@ -34,7 +34,7 @@ class IndicatorPage(emulators.UnityEmulatorBase):
34 return False
34 return False
35
35
36
36
37−class DisplayIndicator(object):
37+class DisplayIndicator():
38
38
39 def __init__(self, main_window):
39 def __init__(self, main_window):
40 self._main_window = main_window
40 self._main_window = main_window
tests/autopilot/unity8/indicators/tests/__init__.py+1−1
@@ -29,6 +29,6 @@ class IndicatorTestCase(tests.UnityTestCase):
29 def setUp(self):
29 def setUp(self):
30 if platform.model() == 'Desktop':
30 if platform.model() == 'Desktop':
31 self.skipTest('Test cannot be run on the desktop.')
31 self.skipTest('Test cannot be run on the desktop.')
32− super(IndicatorTestCase, self).setUp()
32+ super().setUp()
33 self.unity_proxy = self.launch_unity()
33 self.unity_proxy = self.launch_unity()
34 process_helpers.unlock_unity(self.unity_proxy)
34 process_helpers.unlock_unity(self.unity_proxy)
tests/autopilot/unity8/indicators/tests/test_indicators.py+2−4
@@ -16,8 +16,6 @@
16# You should have received a copy of the GNU General Public License
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
19−from __future__ import absolute_import
20−
21from testscenarios import multiply_scenarios
19from testscenarios import multiply_scenarios
22
20
23from autopilot import platform
21from autopilot import platform
@@ -42,7 +40,7 @@ class IndicatorExistsTestCase(tests.IndicatorTestCase):
42 )
40 )
43
41
44 def setUp(self):
42 def setUp(self):
45− super(IndicatorExistsTestCase, self).setUp()
43+ super().setUp()
46 if (platform.model() == 'Nexus 10' and
44 if (platform.model() == 'Nexus 10' and
47 self.indicator_name == 'indicator-bluetooth'):
45 self.indicator_name == 'indicator-bluetooth'):
48 self.skipTest('Nexus 10 does not have bluetooth at the moment.')
46 self.skipTest('Nexus 10 does not have bluetooth at the moment.')
@@ -77,7 +75,7 @@ class IndicatorPageTitleMatchesWidgetTestCase(tests.IndicatorTestCase):
77 )
75 )
78
76
79 def setUp(self):
77 def setUp(self):
80− super(IndicatorPageTitleMatchesWidgetTestCase, self).setUp()
78+ super().setUp()
81 if (platform.model() == 'Nexus 10' and
79 if (platform.model() == 'Nexus 10' and
82 self.indicator_name == 'indicator-bluetooth'):
80 self.indicator_name == 'indicator-bluetooth'):
83 self.skipTest('Nexus 10 does not have bluetooth at the moment.')
81 self.skipTest('Nexus 10 does not have bluetooth at the moment.')
tests/autopilot/unity8/process_helpers.py+2−9
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Utilities
3# Unity Autopilot Utilities
4−# Copyright (C) 2013, 2014 Canonical
4+# Copyright (C) 2013, 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -19,16 +19,9 @@
19
19
20import logging
20import logging
21import subprocess
21import subprocess
22−import sys
23import dbus
22import dbus
24
23
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
24+from autopilot.exceptions import ProcessSearchError
30−else:
31− from autopilot.introspection import ProcessSearchError
32from autopilot.introspection import get_proxy_object_for_existing_process
25from autopilot.introspection import get_proxy_object_for_existing_process
33
26
34from unity8.shell import emulators
27from unity8.shell import emulators
tests/autopilot/unity8/shell/__init__.py+2−2
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012-2013 Canonical
4+# Copyright (C) 2012-2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ def disable_qml_mocking(fn):
38 return wrapper
38 return wrapper
39
39
40
40
41−class DragMixin(object):
41+class DragMixin():
42 def _drag(self, x1, y1, x2, y2):
42 def _drag(self, x1, y1, x2, y2):
43 # XXX This ugly code is here just temporarily, waiting for drag
43 # XXX This ugly code is here just temporarily, waiting for drag
44 # improvements to land on autopilot so we don't have to access device
44 # improvements to land on autopilot so we don't have to access device
tests/autopilot/unity8/shell/emulators/create_interactive_notification.py+2−3
@@ -1,10 +1,9 @@
1−#!/usr/bin/env python
1+#!/usr/bin/env python3
2−from __future__ import print_function
3
2
4# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
5#
4#
6# Unity Autopilot Test Suite
5# Unity Autopilot Test Suite
7−# Copyright (C) 2012-2013 Canonical
6+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
8#
7#
9# This program is free software: you can redistribute it and/or modify
8# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
9# 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 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012, 2013, 2014 Canonical
4+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ from ubuntuuitoolkit import emulators as toolkit_emulators
30logger = logging.getLogger(__name__)
30logger = logging.getLogger(__name__)
31
31
32
32
33−class DashApp(object):
33+class DashApp():
34
34
35 """Autopilot helper for the Dash app."""
35 """Autopilot helper for the Dash app."""
36
36
@@ -45,7 +45,7 @@ class Dash(emulators.UnityEmulatorBase):
45 """An emulator that understands the Dash."""
45 """An emulator that understands the Dash."""
46
46
47 def __init__(self, *args):
47 def __init__(self, *args):
48− super(Dash, self).__init__(*args)
48+ super().__init__(*args)
49 self.dash_content_list = self.wait_select_single(
49 self.dash_content_list = self.wait_select_single(
50 'QQuickListView', objectName='dashContentList')
50 'QQuickListView', objectName='dashContentList')
51
51
tests/autopilot/unity8/shell/fixture_setup.py+2−2
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ import unity8
31class FakeScopes(fixtures.Fixture):
31class FakeScopes(fixtures.Fixture):
32
32
33 def setUp(self):
33 def setUp(self):
34− super(FakeScopes, self).setUp()
34+ super().setUp()
35 self.useFixture(
35 self.useFixture(
36 fixtures.EnvironmentVariable(
36 fixtures.EnvironmentVariable(
37 'QML2_IMPORT_PATH',
37 'QML2_IMPORT_PATH',
tests/autopilot/unity8/shell/tests/__init__.py+3−3
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012, 2013, 2014 Canonical
4+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -148,7 +148,7 @@ class UnityTestCase(AutopilotTestCase):
148 sys.exit(2)
148 sys.exit(2)
149
149
150 def setUp(self):
150 def setUp(self):
151− super(UnityTestCase, self).setUp()
151+ super().setUp()
152 if is_unity7_running():
152 if is_unity7_running():
153 self.useFixture(toolkit_fixtures.HideUnity7Launcher())
153 self.useFixture(toolkit_fixtures.HideUnity7Launcher())
154
154
@@ -399,7 +399,7 @@ class DashBaseTestCase(AutopilotTestCase):
399 environment = {}
399 environment = {}
400
400
401 def setUp(self):
401 def setUp(self):
402− super(DashBaseTestCase, self).setUp()
402+ super().setUp()
403
403
404 if is_unity7_running():
404 if is_unity7_running():
405 self.useFixture(toolkit_fixtures.HideUnity7Launcher())
405 self.useFixture(toolkit_fixtures.HideUnity7Launcher())
tests/autopilot/unity8/shell/tests/test_emulators.py+4−4
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@ class MainWindowTestCase(tests.UnityTestCase):
38 scenarios = tests._get_device_emulation_scenarios()
38 scenarios = tests._get_device_emulation_scenarios()
39
39
40 def setUp(self):
40 def setUp(self):
41− super(MainWindowTestCase, self).setUp()
41+ super().setUp()
42 unity_proxy = self.launch_unity()
42 unity_proxy = self.launch_unity()
43 process_helpers.unlock_unity(unity_proxy)
43 process_helpers.unlock_unity(unity_proxy)
44
44
@@ -110,7 +110,7 @@ class GenericScopeViewEmulatorTestCase(tests.DashBaseTestCase):
110 def setUp(self):
110 def setUp(self):
111 # Set up the fake scopes before launching unity.
111 # Set up the fake scopes before launching unity.
112 self.useFixture(fixture_setup.FakeScopes())
112 self.useFixture(fixture_setup.FakeScopes())
113− super(GenericScopeViewEmulatorTestCase, self).setUp()
113+ super().setUp()
114 self.generic_scope = self.dash.open_scope('MockScope1')
114 self.generic_scope = self.dash.open_scope('MockScope1')
115
115
116 def test_open_preview(self):
116 def test_open_preview(self):
@@ -129,7 +129,7 @@ class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
129 def setUp(self):
129 def setUp(self):
130 # Set up the fake scopes before launching unity.
130 # Set up the fake scopes before launching unity.
131 self.useFixture(fixture_setup.FakeScopes())
131 self.useFixture(fixture_setup.FakeScopes())
132− super(DashAppsEmulatorTestCase, self).setUp()
132+ super().setUp()
133 self.applications_scope = self.dash.open_scope('clickscope')
133 self.applications_scope = self.dash.open_scope('clickscope')
134
134
135 def test_get_applications_should_return_correct_applications(self):
135 def test_get_applications_should_return_correct_applications(self):
tests/autopilot/unity8/shell/tests/test_lock_screen.py+1−9
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012, 2013, 2014 Canonical
4+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -17,22 +17,14 @@
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
18#
19
19
20−
21−from __future__ import absolute_import
22−
23from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
20from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
24
21
25from autopilot.matchers import Eventually
22from autopilot.matchers import Eventually
26−import sys
27from testtools.matchers import Equals
23from testtools.matchers import Equals
28import logging
24import logging
29
25
30logger = logging.getLogger(__name__)
26logger = logging.getLogger(__name__)
31
27
32−# py2 compatible alias for py3
33−if sys.version >= '3':
34− basestring = str
35−
36
28
37class TestLockscreen(UnityTestCase):
29class TestLockscreen(UnityTestCase):
38
30
tests/autopilot/unity8/shell/tests/test_notifications.py+4−12
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012, 2013, 2014 Canonical
4+# Copyright (C) 2012, 2013, 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -19,8 +19,6 @@
19
19
20"""Tests for Notifications"""
20"""Tests for Notifications"""
21
21
22−from __future__ import absolute_import
23−
24from unity8 import shell
22from unity8 import shell
25from unity8.process_helpers import unlock_unity
23from unity8.process_helpers import unlock_unity
26from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
24from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
@@ -34,15 +32,9 @@ import os
34import logging
32import logging
35import signal
33import signal
36import subprocess
34import subprocess
37−import sys
38
35
39logger = logging.getLogger(__name__)
36logger = logging.getLogger(__name__)
40
37
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−
46
38
47class NotificationsBase(UnityTestCase):
39class NotificationsBase(UnityTestCase):
48 """Base class for all notification tests that provides helper methods."""
40 """Base class for all notification tests that provides helper methods."""
@@ -118,7 +110,7 @@ class InteractiveNotificationBase(NotificationsBase):
118 """Collection of test for Interactive tests including snap decisions."""
110 """Collection of test for Interactive tests including snap decisions."""
119
111
120 def setUp(self):
112 def setUp(self):
121− super(InteractiveNotificationBase, self).setUp()
113+ super().setUp()
122 # Need to keep track when we launch the notification script.
114 # Need to keep track when we launch the notification script.
123 self._notify_proc = None
115 self._notify_proc = None
124
116
@@ -338,7 +330,7 @@ class InteractiveNotificationBase(NotificationsBase):
338 action_string = "%s,%s" % (action_id, action_label)
330 action_string = "%s,%s" % (action_id, action_label)
339 script_args.extend(['--action', action_string])
331 script_args.extend(['--action', action_string])
340
332
341− python_bin = subprocess.check_output(['which', 'python']).strip()
333+ python_bin = subprocess.check_output(['which', 'python3']).strip()
342 command = [python_bin, self._get_notify_script()] + script_args
334 command = [python_bin, self._get_notify_script()] + script_args
343 logger.info("Launching snap-decision notification as: %s", command)
335 logger.info("Launching snap-decision notification as: %s", command)
344 self._notify_proc = subprocess.Popen(
336 self._notify_proc = subprocess.Popen(
@@ -410,7 +402,7 @@ class EphemeralNotificationsTests(NotificationsBase):
410 """Collection of tests for Emphemeral notifications (non-interactive.)"""
402 """Collection of tests for Emphemeral notifications (non-interactive.)"""
411
403
412 def setUp(self):
404 def setUp(self):
413− super(EphemeralNotificationsTests, self).setUp()
405+ super().setUp()
414 # Because we are using the Notify library we need to init and un-init
406 # Because we are using the Notify library we need to init and un-init
415 # otherwise we get crashes.
407 # otherwise we get crashes.
416 Notify.init("Autopilot Ephemeral Notification Tests")
408 Notify.init("Autopilot Ephemeral Notification Tests")
tests/autopilot/unity8/shell/tests/test_tutorial.py+2−2
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2014 Canonical
4+# Copyright (C) 2014, 2015 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ from unity8.shell.emulators import tutorial # NOQA
31class TutorialTestCase(tests.UnityTestCase):
31class TutorialTestCase(tests.UnityTestCase):
32
32
33 def setUp(self):
33 def setUp(self):
34− super(TutorialTestCase, self).setUp()
34+ super().setUp()
35 self._qml_mock_enabled = False
35 self._qml_mock_enabled = False
36 self._data_dirs_mock_enabled = False
36 self._data_dirs_mock_enabled = False
37
37
tests/autopilot/unity8/shell/tests/test_upstart.py+1−7
@@ -38,12 +38,6 @@ import logging
38
38
39logger = logging.getLogger(__name__)
39logger = logging.getLogger(__name__)
40
40
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−
47
41
48class UpstartIntegrationTests(UnityTestCase):
42class UpstartIntegrationTests(UnityTestCase):
49
43
@@ -95,7 +89,7 @@ class UpstartIntegrationTests(UnityTestCase):
95 self.addCleanup(ensure_stopped)
89 self.addCleanup(ensure_stopped)
96
90
97 def _set_proxy(self):
91 def _set_proxy(self):
98− super(UpstartIntegrationTests, self)._set_proxy(
92+ super()._set_proxy(
99 get_proxy_object_for_existing_process(
93 get_proxy_object_for_existing_process(
100 pid=self.process.pid,
94 pid=self.process.pid,
101 emulator_base=UnityEmulatorBase,))
95 emulator_base=UnityEmulatorBase,))