Merge lp:~ubuntu-core-dev/ubuntu-ui-toolkit/py32ap into lp:ubuntu-ui-toolkit

Proposed by Dimitri John Ledkov
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 955
Merged at revision: 965
Proposed branch: lp:~ubuntu-core-dev/ubuntu-ui-toolkit/py32ap
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 273 lines (+53/-28)
13 files modified
debian/control (+9/-6)
debian/rules (+1/-0)
debian/ubuntu-ui-toolkit-autopilot.install (+2/-1)
run_tests.sh (+2/-2)
tests/autopilot/ubuntuuitoolkit/base.py (+3/-2)
tests/autopilot/ubuntuuitoolkit/emulators.py (+8/-8)
tests/autopilot/ubuntuuitoolkit/fixture_setup.py (+1/-1)
tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py (+4/-1)
tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py (+6/-1)
tests/qmlapicheck.py (+4/-2)
tests/tests.pro (+5/-2)
tests/unit/add_qmlmakecheck.pri (+2/-1)
ubuntu-sdk.pro (+6/-1)
To merge this branch: bzr merge lp:~ubuntu-core-dev/ubuntu-ui-toolkit/py32ap
Reviewer Review Type Date Requested Status
Zoltan Balogh Approve
PS Jenkins bot continuous-integration Approve
Dimitri John Ledkov (community) Approve
Barry Warsaw (community) Needs Fixing
Review via email: mp+207757@code.launchpad.net

Commit message

Ship python3 autopilot emulators/tests.

Description of the change

Ship python3 autopilot emulators/tests.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Florian Boucault (fboucault) wrote :

Please link to bug https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1268801
I guess this MR superseeds https://code.launchpad.net/~barry/ubuntu-ui-toolkit/py3ap/+merge/201529 whose commit message is much more complete. Can you use that commit message instead?

Also it says:
"[...] This branch depends on Qt5.2"

Is this MR dependent on 5.2 as well?

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

On 24 February 2014 10:49, Florian Boucault
<email address hidden> wrote:
> Please link to bug https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1268801
> I guess this MR superseeds https://code.launchpad.net/~barry/ubuntu-ui-toolkit/py3ap/+merge/201529 whose commit message is much more complete. Can you use that commit message instead?
>
> Also it says:
> "[...] This branch depends on Qt5.2"
>
> Is this MR dependent on 5.2 as well?

no, it does not. I believe that comment was about
lp:ubuntu-ui-toolkit, back at the time of first round of merge
proposals, used to depend on qt5.2, which i don't believe is the case
at present.

--
Regards,

Dimitri.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I found a few more things i'd like to fix here. Please hold this one for a little while.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

This now is fully python2 & 3 bilingual, with tests passing with same results under either python version.

Please merge and release this asap, as it's on a critical path to remove python2 from the images.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Barry Warsaw (barry) wrote :

I've verified that all my changes from my superseded branch made it into this one. LGTM.

review: Approve
Revision history for this message
Barry Warsaw (barry) wrote :

Oops, there's a bug. Not sure how you avoided hitting this, but you'll want to double check your tests.

Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/loader.py", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.4/unittest/loader.py", line 290, in _get_module_from_name
    __import__(name)
  File "/usr/lib/python3/dist-packages/ubuntuuitoolkit/tests/test_fixture_setup.py", line 19, in <module>
    import mock
ImportError: No module named 'mock'

=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py'
--- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-02-12 18:41:20 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-02-24 23:24:43 +0000
@@ -16,7 +16,12 @@

 import os

-import mock
+try:
+ # Python 3.
+ from unittest import mock
+except ImportError:
+ # Python 2 add-on: python-mock.
+ import mock
 import testtools
 from autopilot import testcase as autopilot_testcase
 from testtools.matchers import Contains, Not, FileExists

review: Needs Fixing
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

> Oops, there's a bug. Not sure how you avoided hitting this, but you'll want
> to double check your tests.
>

Ah, i used phablet-test-run and that added mock to my pythonpath.

Patch applied, thanks.

> Traceback (most recent call last):
> File "/usr/lib/python3.4/unittest/loader.py", line 312, in _find_tests
> module = self._get_module_from_name(name)
> File "/usr/lib/python3.4/unittest/loader.py", line 290, in
> _get_module_from_name
> __import__(name)
> File "/usr/lib/python3/dist-
> packages/ubuntuuitoolkit/tests/test_fixture_setup.py", line 19, in <module>
> import mock
> ImportError: No module named 'mock'
>
> === modified file
> 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py'
> --- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-02-12
> 18:41:20 +0000
> +++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-02-24
> 23:24:43 +0000
> @@ -16,7 +16,12 @@
>
> import os
>
> -import mock
> +try:
> + # Python 3.
> + from unittest import mock
> +except ImportError:
> + # Python 2 add-on: python-mock.
> + import mock
> import testtools
> from autopilot import testcase as autopilot_testcase
> from testtools.matchers import Contains, Not, FileExists

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

OK

review: Approve
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

Please resolve the conflict with the tests/autopilot/ubuntuuitoolkit/emulators.py

review: Needs Fixing
955. By Dimitri John Ledkov

Merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

back to OK

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-03-01 12:51:13 +0000
3+++ debian/control 2014-03-03 09:26:35 +0000
4@@ -6,6 +6,7 @@
5 devscripts,
6 libgles2-mesa-dev,
7 libglib2.0-dev,
8+ python3,
9 python,
10 libqt5qml-graphicaleffects | libqt5graphicaleffects5,
11 qt5-default,
12@@ -22,12 +23,12 @@
13 qtdeclarative5-qtfeedback-plugin,
14 qtdeclarative5-unity-action-plugin (>= 1.1.0),
15 qtdeclarative5-localstorage-plugin,
16- qtdeclarative5-doc-html,
17- qtwebkit5-doc-html,
18- qtsvg5-doc-html,
19- qtscript5-doc-html,
20- qtmultimedia5-doc-html,
21- unity-action-doc,
22+ qtdeclarative5-doc-html,
23+ qtwebkit5-doc-html,
24+ qtsvg5-doc-html,
25+ qtscript5-doc-html,
26+ qtmultimedia5-doc-html,
27+ unity-action-doc,
28 devscripts,
29 libqt5organizer5,
30 qtpim5-dev,
31@@ -135,6 +136,8 @@
32 python-autopilot (>= 1.4),
33 python-fixtures,
34 python-mock,
35+ python3-fixtures,
36+ python3-autopilot (>= 1.4),
37 ubuntu-ui-toolkit-examples (>= ${source:Version}),
38 Description: Test package for Ubuntu UI Toolkit
39 Autopilot tests for the ubuntu-ui-toolkit package
40
41=== modified file 'debian/rules'
42--- debian/rules 2014-03-01 12:51:13 +0000
43+++ debian/rules 2014-03-03 09:26:35 +0000
44@@ -11,6 +11,7 @@
45 override_dh_auto_test:
46 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
47 mkdir -p debian/tmp/home/run
48+ chmod +x tests/xvfb.sh
49 tests/xvfb.sh dh_auto_test || exit $?
50 endif
51
52
53=== modified file 'debian/ubuntu-ui-toolkit-autopilot.install'
54--- debian/ubuntu-ui-toolkit-autopilot.install 2013-10-30 11:35:57 +0000
55+++ debian/ubuntu-ui-toolkit-autopilot.install 2014-03-03 09:26:35 +0000
56@@ -1,1 +1,2 @@
57-usr/lib/python2.7/dist-packages/ubuntuuitoolkit
58+usr/lib/python3
59+usr/lib/python2.7
60
61=== modified file 'run_tests.sh'
62--- run_tests.sh 2013-09-26 13:12:49 +0000
63+++ run_tests.sh 2014-03-03 09:26:35 +0000
64@@ -21,9 +21,9 @@
65
66 UBUNTU_UI_TOOLKIT_AUTOPILOT_FROM_SOURCE=1
67 if [ "$1" == "" ]; then
68- autopilot run ubuntuuitoolkit
69+ python3 -m autopilot.run run ubuntuuitoolkit
70 else
71- autopilot run -o ../../$1 -f xml -r -rd ../../ ubuntuuitoolkit
72+ python3 -m autopilot.run run -o ../../$1 -f xml -r -rd ../../ ubuntuuitoolkit
73 fi
74
75 exit 0
76
77=== modified file 'tests/autopilot/ubuntuuitoolkit/base.py'
78--- tests/autopilot/ubuntuuitoolkit/base.py 2013-11-15 05:11:10 +0000
79+++ tests/autopilot/ubuntuuitoolkit/base.py 2014-03-03 09:26:35 +0000
80@@ -31,8 +31,9 @@
81 # configuration on devices and it seems the environment variable
82 # QT_SELECT=qt5 doesn't work for autopilot tests. --Mirv - 2013-10-03
83 arch = subprocess.check_output(
84- ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"]).strip()
85- return '/usr/lib/{}/qt5/bin/qmlscene'.format(arch.decode())
86+ ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"],
87+ universal_newlines=True).strip()
88+ return '/usr/lib/{}/qt5/bin/qmlscene'.format(arch)
89
90
91 class UbuntuUIToolkitAppTestCase(testcase.AutopilotTestCase):
92
93=== modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py'
94--- tests/autopilot/ubuntuuitoolkit/emulators.py 2014-03-01 12:52:42 +0000
95+++ tests/autopilot/ubuntuuitoolkit/emulators.py 2014-03-03 09:26:35 +0000
96@@ -582,7 +582,7 @@
97
98 def _show_more_elements(self, direction):
99 x, y, width, height = self.globalRect
100- start_x = stop_x = x + (width / 2)
101+ start_x = stop_x = x + (width // 2)
102 # Start and stop just a little under the top of the list.
103 top = y + 5
104 bottom = y + height - 5
105@@ -607,7 +607,7 @@
106 def _is_element_clickable(self, objectName):
107 """Return True if the center of the element is visible."""
108 element = self.select_single(objectName=objectName)
109- element_center = element.globalRect.y + element.globalRect.height / 2
110+ element_center = element.globalRect.y + element.globalRect.height // 2
111 return (element_center >= self.globalRect.y and
112 element_center <= self.globalRect.y + self.globalRect.height)
113
114@@ -628,7 +628,7 @@
115 @autopilot_logging.log_action(logger.info)
116 def swipe_to_delete(self, direction='right'):
117 """Swipe the item in a specific direction."""
118- if (self.removable):
119+ if self.removable:
120 self._drag_pointing_device_to_delete(direction)
121 if self.confirmRemoval:
122 self.waitingConfirmationForRemoval.wait_for(True)
123@@ -640,12 +640,12 @@
124
125 def _drag_pointing_device_to_delete(self, direction):
126 x, y, w, h = self.globalRect
127- tx = x + (w / 8)
128- ty = y + (h / 2)
129+ tx = x + (w // 8)
130+ ty = y + (h // 2)
131
132- if (direction == 'right'):
133+ if direction == 'right':
134 self.pointing_device.drag(tx, ty, w, ty)
135- elif (direction == 'left'):
136+ elif direction == 'left':
137 self.pointing_device.drag(w - (w*0.1), ty, x, ty)
138 else:
139 raise ToolkitEmulatorException(
140@@ -663,7 +663,7 @@
141 @autopilot_logging.log_action(logger.info)
142 def confirm_removal(self):
143 """Comfirm item removal if this was already swiped."""
144- if (self.waitingConfirmationForRemoval):
145+ if self.waitingConfirmationForRemoval:
146 deleteButton = self._get_confirm_button()
147 self.pointing_device.click_object(deleteButton)
148 self._wait_until_deleted()
149
150=== modified file 'tests/autopilot/ubuntuuitoolkit/fixture_setup.py'
151--- tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-02-12 09:20:43 +0000
152+++ tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-03-03 09:26:35 +0000
153@@ -87,7 +87,7 @@
154 qmlscene=base.get_qmlscene_launch_command(),
155 qml_file_path=qml_file_path))
156 desktop_file.write('[Desktop Entry]\n')
157- for key, value in self._desktop_file_dict.iteritems():
158+ for key, value in self._desktop_file_dict.items():
159 desktop_file.write('{key}={value}\n'.format(key=key, value=value))
160 desktop_file.close()
161 return desktop_file.name
162
163=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py'
164--- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-03-01 12:52:15 +0000
165+++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-03-03 09:26:35 +0000
166@@ -14,7 +14,6 @@
167 # You should have received a copy of the GNU Lesser General Public License
168 # along with this program. If not, see <http://www.gnu.org/licenses/>.
169
170-import mock
171 import time
172 import unittest
173
174@@ -22,6 +21,10 @@
175 from autopilot import input, platform
176 from autopilot.introspection import dbus
177 from testtools.matchers import GreaterThan, LessThan
178+try:
179+ from unittest import mock
180+except ImportError:
181+ import mock
182
183 from ubuntuuitoolkit import emulators, tests
184
185
186=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py'
187--- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-02-12 18:41:20 +0000
188+++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-03-03 09:26:35 +0000
189@@ -16,7 +16,12 @@
190
191 import os
192
193-import mock
194+try:
195+ # Python 3.
196+ from unittest import mock
197+except ImportError:
198+ # Python 2 add-on: python-mock.
199+ import mock
200 import testtools
201 from autopilot import testcase as autopilot_testcase
202 from testtools.matchers import Contains, Not, FileExists
203
204=== modified file 'tests/qmlapicheck.py'
205--- tests/qmlapicheck.py 2013-12-11 11:28:29 +0000
206+++ tests/qmlapicheck.py 2014-03-03 09:26:35 +0000
207@@ -1,4 +1,4 @@
208-#!/usr/bin/env python
209+#!/usr/bin/env python3
210 # -*- coding: utf-8 -*-
211 #
212 # Copyright 2013 Canonical Ltd.
213@@ -65,7 +65,9 @@
214 fileinput.nextfile()
215
216 inputfiles.sort()
217-for line in fileinput.input(inputfiles):
218+
219+hook = fileinput.hook_encoded('utf-8')
220+for line in fileinput.input(inputfiles, openhook=hook):
221 # New file
222 if fileinput.isfirstline():
223 in_block = 0
224
225=== modified file 'tests/tests.pro'
226--- tests/tests.pro 2013-10-30 11:35:57 +0000
227+++ tests/tests.pro 2014-03-03 09:26:35 +0000
228@@ -1,7 +1,10 @@
229 TEMPLATE = subdirs
230 SUBDIRS += unit unit_x11
231
232-autopilot_module.path = /usr/lib/python2.7/dist-packages/ubuntuuitoolkit
233+autopilot_module.path = /usr/lib/python3/dist-packages/ubuntuuitoolkit
234 autopilot_module.files = autopilot/ubuntuuitoolkit/*
235
236-INSTALLS += autopilot_module
237+autopilot2_module.path = /usr/lib/python2.7/dist-packages/ubuntuuitoolkit
238+autopilot2_module.files = autopilot/ubuntuuitoolkit/*
239+
240+INSTALLS += autopilot_module autopilot2_module
241
242=== modified file 'tests/unit/add_qmlmakecheck.pri'
243--- tests/unit/add_qmlmakecheck.pri 2014-02-11 12:42:55 +0000
244+++ tests/unit/add_qmlmakecheck.pri 2014-03-03 09:26:35 +0000
245@@ -14,5 +14,6 @@
246 check.commands += qmlplugindump Ubuntu.Components 0.1 modules 2>/dev/null > plugins.qmltypes;
247 check.commands += qmlplugindump Ubuntu.PerformanceMetrics 0.1 modules 2>/dev/null >> plugins.qmltypes;
248 # Palette gets included in Qt 5.2 qmlplugindump even though it's qml
249-check.commands += BUILTINS=QQuick,QQml,U1db::,Palette python tests/qmlapicheck.py modules/Ubuntu/Components/qmldir modules/Ubuntu/Components/Colors/UbuntuColors.qml modules/Ubuntu/Components/Pickers/PickerPanel.qml modules/Ubuntu/Components/*/qmldir modules/Ubuntu/PerformanceMetrics/qmldir plugins.qmltypes > components.api.new;
250+
251+check.commands += BUILTINS=QQuick,QQml,U1db::,Palette python3 tests/qmlapicheck.py modules/Ubuntu/Components/qmldir modules/Ubuntu/Components/Colors/UbuntuColors.qml modules/Ubuntu/Components/Pickers/PickerPanel.qml modules/Ubuntu/Components/*/qmldir modules/Ubuntu/PerformanceMetrics/qmldir plugins.qmltypes > components.api.new;
252 check.commands += diff -Fqml -u components.api components.api.new || exit 1; cd tests/unit
253
254=== modified file 'ubuntu-sdk.pro'
255--- ubuntu-sdk.pro 2013-12-12 13:01:56 +0000
256+++ ubuntu-sdk.pro 2014-03-03 09:26:35 +0000
257@@ -22,10 +22,15 @@
258 QMAKE_EXTRA_TARGETS += test_api
259
260 test_components.target = test-components
261-test_components.commands = cd tests/autopilot; autopilot run ubuntuuitoolkit
262+test_components.commands = cd tests/autopilot; python3 -m autopilot.run run ubuntuuitoolkit
263 test_components.depends = modules/ubuntu-ui-toolkit.pro
264 QMAKE_EXTRA_TARGETS += test_components
265
266+test_components2.target = test-components2
267+test_components2.commands = cd tests/autopilot; python2 -m autopilot.run run ubuntuuitoolkit
268+test_components2.depends = modules/ubuntu-ui-toolkit.pro
269+QMAKE_EXTRA_TARGETS += test_components2
270+
271 qmluitests.target = qmluitests
272 qmluitests.commands = cd tests/unit_x11; make check
273 qmluitests.depends = modules/ubuntu-ui-toolkit.pro

Subscribers

People subscribed via source and target branches

to status/vote changes: