on xenial help sign in
Use the base class from the toolkit in autopilot tests.
020b135Leo Arias
tests/autopilot/unity8/fixture_setup.py+2−2
@@ -21,13 +21,13 @@ import fixtures
21import subprocess
21import subprocess
22import logging
22import logging
23
23
24+import ubuntuuitoolkit
24from autopilot import introspection
25from autopilot import introspection
25
26
26from unity8 import (
27from unity8 import (
27 get_binary_path,
28 get_binary_path,
28 process_helpers
29 process_helpers
29)
30)
30−from unity8.shell import emulators
31
31
32logger = logging.getLogger(__name__)
32logger = logging.getLogger(__name__)
33
33
@@ -65,7 +65,7 @@ class LaunchDashApp(fixtures.Fixture):
65 pid = process_helpers.start_job('unity8-dash', *all_args)
65 pid = process_helpers.start_job('unity8-dash', *all_args)
66 return introspection.get_proxy_object_for_existing_process(
66 return introspection.get_proxy_object_for_existing_process(
67 pid=pid,
67 pid=pid,
68− emulator_base=emulators.UnityEmulatorBase,
68+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
69 )
69 )
70
70
71 def stop_application(self):
71 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
@@ -35,6 +35,8 @@ import os.path
35import subprocess
35import subprocess
36import sys
36import sys
37from testtools.matchers import Equals
37from testtools.matchers import Equals
38+
39+import ubuntuuitoolkit
38from ubuntuuitoolkit import (
40from ubuntuuitoolkit import (
39 fixture_setup as toolkit_fixtures,
41 fixture_setup as toolkit_fixtures,
40 ubuntu_scenarios
42 ubuntu_scenarios
@@ -51,7 +53,6 @@ from unity8 import (
51 fixture_setup,
53 fixture_setup,
52 process_helpers
54 process_helpers
53)
55)
54−from unity8.shell import emulators
55from unity8.shell.emulators import (
56from unity8.shell.emulators import (
56 dash as dash_helpers,
57 dash as dash_helpers,
57 main_window as main_window_emulator,
58 main_window as main_window_emulator,
@@ -369,7 +370,7 @@ class UnityTestCase(AutopilotTestCase):
369 pid = process_helpers.get_job_pid('unity8-dash')
370 pid = process_helpers.get_job_pid('unity8-dash')
370 dash_proxy = introspection.get_proxy_object_for_existing_process(
371 dash_proxy = introspection.get_proxy_object_for_existing_process(
371 pid=pid,
372 pid=pid,
372− emulator_base=emulators.UnityEmulatorBase,
373+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
373 )
374 )
374 dash_app = dash_helpers.DashApp(dash_proxy)
375 dash_app = dash_helpers.DashApp(dash_proxy)
375 return dash_app.dash
376 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(