Merge lp:~canonical-platform-qa/camera-app/fix_base_class into lp:camera-app

Proposed by Leo Arias on 2015-04-28
Status: Merged
Approved by: Florian Boucault on 2015-05-05
Approved revision: 555
Merged at revision: 557
Proposed branch: lp:~canonical-platform-qa/camera-app/fix_base_class
Merge into: lp:camera-app
Diff against target: 121 lines (+11/-43)
3 files modified
tests/autopilot/camera_app/emulators/baseemulator.py (+0/-35)
tests/autopilot/camera_app/emulators/panel.py (+2/-2)
tests/autopilot/camera_app/tests/__init__.py (+9/-6)
To merge this branch: bzr merge lp:~canonical-platform-qa/camera-app/fix_base_class
Reviewer Review Type Date Requested Status
Brendan Donegan (community) Approve on 2015-04-30
PS Jenkins bot continuous-integration Needs Fixing on 2015-04-30
Ubuntu Phablet Team 2015-04-28 Pending
Review via email: mp+257658@code.launchpad.net

Commit Message

Use the base class from the toolkit in autopilot tests.

Description of the Change

Are there any related MPs required for this MP to build/function as expected? Please list.

No related MPs.

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

Yes it is.

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

Only made sure the automated tests were working as before.

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/<package-name>) on device or emulator?

Only changes to the automated tests, so no need to run the test plan.

If you changed the UI, was the change specified/approved by design?

No UI changes.

If you changed UI labels, did you update the pot file?

No UI changes.

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

No debian changes.

Autopilot is currently designed to have a single proxy object base, so we started finding some problems when we integrated tests from multiple projects for the sanity suite. We are working on making autopilot smarter, but in order to be able to change the design without breaking any tests we need this change.
And in this case, it makes sense to use the proxy object from the toolkit, because the one defined for this project was just duplicating the code.

To post a comment you must log in.
Christopher Lee (veebers) wrote :

Looks good to me, although I will moan that there are changes here that aren't directly relevant to the base CPO class change (i.e. removal of unused imports).

The CI failed due to an infrastructure timeout, firing off again hopefully we have better luck this time around.

Brendan Donegan (brendan-donegan) wrote :

I'm inclined to agree with veebers - single issue changes please to avoid the chance of unrelated things blocking the merge approval (see how it is already :P). Also the mix of specifying the base class as a variable and also directly is a little jarring - couldn't you make it a class attribute or 'constant' (i.e. PROXY_BASE = ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase at the file level)

review: Needs Information
554. By Leo Arias on 2015-04-29

Reverted the unused imports, will remove them in a following branch.

Leo Arias (elopio) wrote :

> Looks good to me, although I will moan that there are changes here that aren't
> directly relevant to the base CPO class change (i.e. removal of unused
> imports).
>
> The CI failed due to an infrastructure timeout, firing off again hopefully we
> have better luck this time around.

Right... we have discussed about it and I keep doing it. Sorry.
Pushed.

555. By Leo Arias on 2015-04-29

Use a constant for the base class.

Leo Arias (elopio) wrote :

> Also the mix of specifying the base class as a variable and also directly
> is a little jarring - couldn't you make it a class attribute or 'constant'
> (i.e. PROXY_BASE = ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase at the
> file level)

That's an alias, because the name is too big to fit the 88 columns.
A constant works well too, so pushed.
Maybe we need to add a shorter alias directly on the toolkit.

Max Brustkern (nuclearbob) wrote :

This seems reasonable to me once the CI jobs stop failing.

Brendan Donegan (brendan-donegan) wrote :

Looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'tests/autopilot/camera_app/emulators/baseemulator.py'
2--- tests/autopilot/camera_app/emulators/baseemulator.py 2014-06-26 11:49:31 +0000
3+++ tests/autopilot/camera_app/emulators/baseemulator.py 1970-01-01 00:00:00 +0000
4@@ -1,35 +0,0 @@
5-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
6-# Copyright 2014 Canonical
7-#
8-# This program is free software: you can redistribute it and/or modify it
9-# under the terms of the GNU General Public License version 3, as published
10-# by the Free Software Foundation.
11-
12-import autopilot
13-from autopilot import (
14- input,
15- platform
16-)
17-from autopilot.introspection import dbus
18-
19-
20-def get_pointing_device():
21- """Return the pointing device depending on the platform.
22-
23- If the platform is `Desktop`, the pointing device will be a `Mouse`.
24- If not, the pointing device will be `Touch`.
25-
26- """
27- if platform.model() == 'Desktop':
28- input_device_class = input.Mouse
29- else:
30- input_device_class = input.Touch
31- return input.Pointer(device=input_device_class.create())
32-
33-
34-class CameraCustomProxyObjectBase(dbus.CustomEmulatorBase):
35- """A base class for all the Camera App emulators."""
36-
37- def __init__(self, *args):
38- super(CameraCustomProxyObjectBase, self).__init__(*args)
39- self.pointing_device = get_pointing_device()
40
41=== modified file 'tests/autopilot/camera_app/emulators/panel.py'
42--- tests/autopilot/camera_app/emulators/panel.py 2015-03-10 09:46:26 +0000
43+++ tests/autopilot/camera_app/emulators/panel.py 2015-04-29 14:42:36 +0000
44@@ -8,14 +8,14 @@
45 import logging
46 import sys
47
48+import ubuntuuitoolkit
49 from autopilot import logging as autopilot_logging
50-from camera_app.emulators.baseemulator import CameraCustomProxyObjectBase
51
52
53 logger = logging.getLogger(__name__)
54
55
56-class Panel(CameraCustomProxyObjectBase):
57+class Panel(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
58 """Panel Autopilot emulator."""
59
60 @autopilot_logging.log_action(logger.info)
61
62=== modified file 'tests/autopilot/camera_app/tests/__init__.py'
63--- tests/autopilot/camera_app/tests/__init__.py 2015-03-10 13:52:56 +0000
64+++ tests/autopilot/camera_app/tests/__init__.py 2015-04-29 14:42:36 +0000
65@@ -1,5 +1,5 @@
66 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
67-# Copyright 2012 Canonical
68+# Copyright 2012, 2015 Canonical
69 #
70 # This program is free software: you can redistribute it and/or modify it
71 # under the terms of the GNU General Public License version 3, as published
72@@ -13,6 +13,7 @@
73 from time import sleep
74 from pkg_resources import resource_filename
75
76+import ubuntuuitoolkit
77 from autopilot.input import Mouse, Touch, Pointer
78 from autopilot.platform import model
79 from autopilot.testcase import AutopilotTestCase
80@@ -20,7 +21,9 @@
81 from testtools.matchers import Equals
82
83 from camera_app.emulators.main_window import MainWindow
84-from camera_app.emulators.baseemulator import CameraCustomProxyObjectBase
85+
86+
87+CUSTOM_PROXY_OBJECT_BASE = ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase
88
89
90 class CameraAppTestCase(AutopilotTestCase):
91@@ -60,13 +63,13 @@
92 def launch_test_local(self):
93 self.app = self.launch_test_application(
94 self.local_location,
95- emulator_base=CameraCustomProxyObjectBase)
96+ emulator_base=CUSTOM_PROXY_OBJECT_BASE)
97
98 def launch_test_installed(self):
99 if model() == 'Desktop':
100 self.app = self.launch_test_application(
101 "camera-app",
102- emulator_base=CameraCustomProxyObjectBase)
103+ emulator_base=CUSTOM_PROXY_OBJECT_BASE)
104 else:
105 self.app = self.launch_test_application(
106 "camera-app",
107@@ -74,12 +77,12 @@
108 "--desktop_file_hint="
109 "/usr/share/applications/camera-app.desktop",
110 app_type='qt',
111- emulator_base=CameraCustomProxyObjectBase)
112+ emulator_base=CUSTOM_PROXY_OBJECT_BASE)
113
114 def launch_click_installed(self):
115 self.app = self.launch_click_package(
116 "com.ubuntu.camera",
117- emulator_base=CameraCustomProxyObjectBase)
118+ emulator_base=CUSTOM_PROXY_OBJECT_BASE)
119
120 def get_center(self, object_proxy):
121 x, y, w, h = object_proxy.globalRect

Subscribers

People subscribed via source and target branches