on xenial help sign in
Use the base class from the toolkit in autopilot tests.
268e051Leo Arias
tests/autopilot/unity8/fixture_setup.py+2−2
@@ -22,13 +22,13 @@ import logging
22import os
22import os
23import subprocess
23import subprocess
24
24
25+import ubuntuuitoolkit
25from autopilot import introspection
26from autopilot import introspection
26
27
27from unity8 import (
28from unity8 import (
28 get_binary_path,
29 get_binary_path,
29 process_helpers
30 process_helpers
30)
31)
31−from unity8.shell import emulators
32
32
33
33
34logger = logging.getLogger(__name__)
34logger = logging.getLogger(__name__)
@@ -131,7 +131,7 @@ class LaunchDashApp(fixtures.Fixture):
131 pid = process_helpers.start_job('unity8-dash', *all_args)
131 pid = process_helpers.start_job('unity8-dash', *all_args)
132 return introspection.get_proxy_object_for_existing_process(
132 return introspection.get_proxy_object_for_existing_process(
133 pid=pid,
133 pid=pid,
134− emulator_base=emulators.UnityEmulatorBase,
134+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
135 )
135 )
136
136
137 def stop_application(self):
137 def stop_application(self):
tests/autopilot/unity8/indicators/__init__.py+2−4
@@ -18,10 +18,8 @@
18import ubuntuuitoolkit
18import ubuntuuitoolkit
19from autopilot import introspection
19from autopilot import introspection
20
20
21−from unity8.shell import emulators
22
21
23−
22+class IndicatorPage(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
24−class IndicatorPage(emulators.UnityEmulatorBase):
25
23
26 """Autopilot helper for the IndicatorPage component."""
24 """Autopilot helper for the IndicatorPage component."""
27
25
@@ -166,7 +164,7 @@ class TestIndicatorPage(IndicatorPage):
166 return self.select_single(objectName='indicator.action.slider')
164 return self.select_single(objectName='indicator.action.slider')
167
165
168
166
169−class Slider(emulators.UnityEmulatorBase):
167+class Slider(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
170
168
171 """Autopilot helper for the Slider component."""
169 """Autopilot helper for the Slider component."""
172
170
tests/autopilot/unity8/process_helpers.py+2−1
@@ -21,6 +21,7 @@ import logging
21import subprocess
21import subprocess
22import dbus
22import dbus
23
23
24+import ubuntuuitoolkit
24from autopilot.exceptions import ProcessSearchError
25from autopilot.exceptions import ProcessSearchError
25from autopilot.introspection import get_proxy_object_for_existing_process
26from autopilot.introspection import get_proxy_object_for_existing_process
26
27
@@ -271,5 +272,5 @@ def _get_unity_pid():
271def _get_unity_proxy_object(pid):
272def _get_unity_proxy_object(pid):
272 return get_proxy_object_for_existing_process(
273 return get_proxy_object_for_existing_process(
273 pid=pid,
274 pid=pid,
274− emulator_base=emulators.UnityEmulatorBase,
275+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
275 )
276 )
tests/autopilot/unity8/shell/emulators/__init__.py−6
@@ -17,12 +17,6 @@
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−import ubuntuuitoolkit
21−
22−
23−class UnityEmulatorBase(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
24− """A base class for all unity emulators."""
25−
26
20
27class UnityEmulatorException(Exception):
21class UnityEmulatorException(Exception):
28 """Exception raised when there is an error with the Unity emulators."""
22 """Exception raised when there is an error with the Unity emulators."""
tests/autopilot/unity8/shell/emulators/dash.py+6−6
@@ -18,13 +18,13 @@
18#
18#
19
19
20import logging
20import logging
21−import ubuntuuitoolkit
22−
23−from unity8.shell import emulators
24
21
22+import ubuntuuitoolkit
25from autopilot import logging as autopilot_logging
23from autopilot import logging as autopilot_logging
26from autopilot.introspection import dbus
24from autopilot.introspection import dbus
27
25
26+from unity8.shell import emulators
27+
28
28
29logger = logging.getLogger(__name__)
29logger = logging.getLogger(__name__)
30
30
@@ -40,7 +40,7 @@ class DashApp():
40 self.dash = self.main_view.select_single(Dash)
40 self.dash = self.main_view.select_single(Dash)
41
41
42
42
43−class Dash(emulators.UnityEmulatorBase):
43+class Dash(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
44 """An emulator that understands the Dash."""
44 """An emulator that understands the Dash."""
45
45
46 def __init__(self, *args):
46 def __init__(self, *args):
@@ -188,7 +188,7 @@ class ListViewWithPageHeader(ubuntuuitoolkit.QQuickFlickable):
188 pass
188 pass
189
189
190
190
191−class GenericScopeView(emulators.UnityEmulatorBase):
191+class GenericScopeView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
192 """Autopilot emulator for generic scopes."""
192 """Autopilot emulator for generic scopes."""
193
193
194 @autopilot_logging.log_action(logger.info)
194 @autopilot_logging.log_action(logger.info)
@@ -255,5 +255,5 @@ class GenericScopeView(emulators.UnityEmulatorBase):
255 return result
255 return result
256
256
257
257
258−class Preview(emulators.UnityEmulatorBase):
258+class Preview(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
259 """Autopilot custom proxy object for generic previews."""
259 """Autopilot custom proxy object for generic previews."""
tests/autopilot/unity8/shell/emulators/greeter.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) 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
@@ -18,12 +18,10 @@
18#
18#
19
19
20import ubuntuuitoolkit
20import ubuntuuitoolkit
21−
22from autopilot.utilities import sleep
21from autopilot.utilities import sleep
23−from unity8.shell.emulators import UnityEmulatorBase
24
22
25
23
26−class Greeter(UnityEmulatorBase):
24+class Greeter(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
27 """An emulator that understands the greeter screen."""
25 """An emulator that understands the greeter screen."""
28
26
29 def wait_swiped_away(self):
27 def wait_swiped_away(self):
tests/autopilot/unity8/shell/emulators/launcher.py+3−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, 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
@@ -20,6 +20,7 @@
20import logging
20import logging
21
21
22import autopilot.logging
22import autopilot.logging
23+import ubuntuuitoolkit
23
24
24from unity8.shell import emulators
25from unity8.shell import emulators
25
26
@@ -27,7 +28,7 @@ from unity8.shell import emulators
27logger = logging.getLogger(__name__)
28logger = logging.getLogger(__name__)
28
29
29
30
30−class Launcher(emulators.UnityEmulatorBase):
31+class Launcher(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
31
32
32 """An emulator that understands the Launcher."""
33 """An emulator that understands the Launcher."""
33
34
tests/autopilot/unity8/shell/emulators/main_window.py+2−2
@@ -19,17 +19,17 @@
19
19
20import logging
20import logging
21
21
22+import ubuntuuitoolkit
22from autopilot import logging as autopilot_logging
23from autopilot import logging as autopilot_logging
23from autopilot import input
24from autopilot import input
24
25
25−from unity8.shell import emulators
26from unity8.shell.emulators.greeter import Greeter
26from unity8.shell.emulators.greeter import Greeter
27from unity8.shell.emulators.launcher import Launcher
27from unity8.shell.emulators.launcher import Launcher
28
28
29logger = logging.getLogger(__name__)
29logger = logging.getLogger(__name__)
30
30
31
31
32−class QQuickView(emulators.UnityEmulatorBase):
32+class QQuickView(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
33 """An emulator class that makes it easy to interact with the shell"""
33 """An emulator class that makes it easy to interact with the shell"""
34
34
35 def get_greeter(self):
35 def get_greeter(self):
tests/autopilot/unity8/shell/tests/__init__.py+3−2
@@ -33,6 +33,8 @@ from autopilot.testcase import AutopilotTestCase
33from autopilot.matchers import Eventually
33from autopilot.matchers import Eventually
34from autopilot.display import Display
34from autopilot.display import Display
35from testtools.matchers import Equals
35from testtools.matchers import Equals
36+
37+import ubuntuuitoolkit
36from ubuntuuitoolkit import (
38from ubuntuuitoolkit import (
37 fixture_setup as toolkit_fixtures,
39 fixture_setup as toolkit_fixtures,
38 ubuntu_scenarios
40 ubuntu_scenarios
@@ -49,7 +51,6 @@ from unity8 import (
49 fixture_setup,
51 fixture_setup,
50 process_helpers
52 process_helpers
51)
53)
52−from unity8.shell import emulators
53from unity8.shell.emulators import (
54from unity8.shell.emulators import (
54 dash as dash_helpers,
55 dash as dash_helpers,
55 main_window as main_window_emulator,
56 main_window as main_window_emulator,
@@ -289,7 +290,7 @@ class UnityTestCase(AutopilotTestCase):
289 pid = process_helpers.get_job_pid('unity8-dash')
290 pid = process_helpers.get_job_pid('unity8-dash')
290 dash_proxy = introspection.get_proxy_object_for_existing_process(
291 dash_proxy = introspection.get_proxy_object_for_existing_process(
291 pid=pid,
292 pid=pid,
292− emulator_base=emulators.UnityEmulatorBase,
293+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
293 )
294 )
294 dash_app = dash_helpers.DashApp(dash_proxy)
295 dash_app = dash_helpers.DashApp(dash_proxy)
295 return dash_app.dash
296 return dash_app.dash
tests/autopilot/unity8/shell/tests/test_upstart.py+5−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
@@ -26,13 +26,13 @@ import subprocess
26import time
26import time
27
27
28import fixtures
28import fixtures
29−from testtools.matchers import Equals, MismatchError
29+import ubuntuuitoolkit
30from autopilot.matchers import Eventually
30from autopilot.matchers import Eventually
31from autopilot.introspection import get_proxy_object_for_existing_process
31from autopilot.introspection import get_proxy_object_for_existing_process
32+from testtools.matchers import Equals, MismatchError
32from ubuntuuitoolkit import ubuntu_scenarios
33from ubuntuuitoolkit import ubuntu_scenarios
33
34
34from unity8 import get_binary_path
35from unity8 import get_binary_path
35−from unity8.shell.emulators import UnityEmulatorBase
36from unity8.shell.tests import UnityTestCase
36from unity8.shell.tests import UnityTestCase
37
37
38import logging
38import logging
@@ -90,10 +90,11 @@ class UpstartIntegrationTests(UnityTestCase):
90 self.addCleanup(ensure_stopped)
90 self.addCleanup(ensure_stopped)
91
91
92 def _set_proxy(self):
92 def _set_proxy(self):
93+ proxy_base = ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
93 super()._set_proxy(
94 super()._set_proxy(
94 get_proxy_object_for_existing_process(
95 get_proxy_object_for_existing_process(
95 pid=self.process.pid,
96 pid=self.process.pid,
96− emulator_base=UnityEmulatorBase,))
97+ emulator_base=proxy_base))
97
98
98 def test_no_sigstop(self):
99 def test_no_sigstop(self):
99 self.useFixture(
100 self.useFixture(