Merge lp:~elopio/unity-scope-click/update_new_scopes3 into lp:unity-scope-click/devel

Proposed by Leo Arias
Status: Merged
Approved by: dobey
Approved revision: 265
Merged at revision: 260
Proposed branch: lp:~elopio/unity-scope-click/update_new_scopes3
Merge into: lp:unity-scope-click/devel
Prerequisite: lp:~alecu/unity-scope-click/add-readmes
Diff against target: 299 lines (+79/-47)
6 files modified
HACKING (+6/-0)
autopilot/CMakeLists.txt (+2/-2)
autopilot/unityclickscope/fake_servers.py (+13/-13)
autopilot/unityclickscope/test_click_scope.py (+47/-21)
autopilot/unityclickscope/test_fixture_setup.py (+5/-5)
debian/control (+6/-6)
To merge this branch: bzr merge lp:~elopio/unity-scope-click/update_new_scopes3
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
dobey (community) Approve
Review via email: mp+219783@code.launchpad.net

Commit message

Get the test_install_with_credentials_must_start_download autopilot test running.
Launch the clickscope from the build dir if it's available.
Enter the search query with the unity8 helper.
Updated to use python3.

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
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
dobey (dobey) wrote :

220 + 'updated=2014-05-15+14%3A29%3A38.679354&'
222 + 'created=2014-05-15+14%3A29%3A38.679344&'

These are not necessary to have in this string. Let's drop them to avoid unnecessary content here.

286 Depends: libautopilot-qt (>= 1.4),
299 ubuntu-ui-toolkit-autopilot,
300 unity8-autopilot,

These aren't changed in your diff, but with the conversion to python3 here, I think these dependencies also need to be updated to depend on at least the versions of them which also use python3.

review: Needs Fixing
Revision history for this message
Leo Arias (elopio) wrote :

> 220 + 'updated=2014-05-15+14%3A29%3A38.679354&'
> 222 + 'created=2014-05-15+14%3A29%3A38.679344&'
>
> These are not necessary to have in this string. Let's drop them to avoid
> unnecessary content here.

Done

> 286 Depends: libautopilot-qt (>= 1.4),
> 299 ubuntu-ui-toolkit-autopilot,
> 300 unity8-autopilot,
>
> These aren't changed in your diff, but with the conversion to python3 here, I
> think these dependencies also need to be updated to depend on at least the
> versions of them which also use python3.

<elopio> dobey: dpkg-architecture -c sets the environment variable $DEB_HOST_MULTIARCH for the command passed as argument.
<elopio> ubuntu-ui-toolkit-autopilot and unity8-autopilot work with py2 and py3 for now. As soon as possible, the py2 support will be dropped.
<elopio> but they don't have a py3 specific version.
<dobey> elopio: the versions in trusty too?
<elopio> dobey: yes.
<elopio> I haven't ran all the tests in trusty yet, as I plan to enable them only on utopic for now.

Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
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) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'HACKING'
--- HACKING 2014-05-16 17:20:07 +0000
+++ HACKING 2014-05-16 17:20:07 +0000
@@ -38,6 +38,12 @@
38 $ make check-valgrind38 $ make check-valgrind
3939
4040
41Running the autopilot tests
42---------------------------
43
44 $ make test-click-scope-autopilot-fake-servers
45
46
41Running the scope47Running the scope
42-----------------48-----------------
4349
4450
=== modified file 'autopilot/CMakeLists.txt'
--- autopilot/CMakeLists.txt 2014-02-06 17:15:05 +0000
+++ autopilot/CMakeLists.txt 2014-05-16 17:20:07 +0000
@@ -13,7 +13,7 @@
13 DESTINATION ${PYTHON_PACKAGE_DIR}13 DESTINATION ${PYTHON_PACKAGE_DIR}
14)14)
1515
16add_custom_target(test-click-scope-autopilot-local16add_custom_target(test-click-scope-autopilot-fake-servers
17 COMMAND U1_SEARCH_BASE_URL=fake DOWNLOAD_BASE_URL=fake autopilot run ${AUTOPILOT_DIR}17 COMMAND U1_SEARCH_BASE_URL=fake DOWNLOAD_BASE_URL=fake BUILD_DIR=${CMAKE_BINARY_DIR} autopilot3 run -v ${AUTOPILOT_DIR}
18 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}18 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
19)19)
2020
=== modified file 'autopilot/unityclickscope/fake_servers.py'
--- autopilot/unityclickscope/fake_servers.py 2014-02-01 12:31:42 +0000
+++ autopilot/unityclickscope/fake_servers.py 2014-05-16 17:20:07 +0000
@@ -14,28 +14,28 @@
14# You should have received a copy of the GNU General Public License14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import BaseHTTPServer
18import copy17import copy
18import http.server
19import json19import json
20import os20import os
21import tempfile21import tempfile
22import urlparse22import urllib.parse
2323
2424
25class BaseFakeHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):25class BaseFakeHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
2626
27 def send_json_reply(self, code, reply_json):27 def send_json_reply(self, code, reply_json):
28 self.send_response(code)28 self.send_response(code)
29 self.send_header('Content-Type', 'application/json')29 self.send_header('Content-Type', 'application/json')
30 self.end_headers()30 self.end_headers()
31 self.wfile.write(reply_json)31 self.wfile.write(reply_json.encode())
3232
33 def send_file(self, file_path, send_body=True, extra_headers={}):33 def send_file(self, file_path, send_body=True, extra_headers={}):
34 with open(file_path) as file_:34 with open(file_path) as file_:
35 data = file_.read()35 data = file_.read()
36 self.send_response(200)36 self.send_response(200)
37 self.send_header('Content-Length', str(len(data)))37 self.send_header('Content-Length', str(len(data)))
38 for key, value in extra_headers.iteritems():38 for key, value in extra_headers.items():
39 self.send_header(key, value)39 self.send_header(key, value)
40 self.end_headers()40 self.end_headers()
41 if send_body:41 if send_body:
@@ -45,7 +45,7 @@
45 self.send_file(file_path, send_body=False, extra_headers=extra_headers)45 self.send_file(file_path, send_body=False, extra_headers=extra_headers)
4646
4747
48class FakeSearchServer(BaseHTTPServer.HTTPServer, object):48class FakeSearchServer(http.server.HTTPServer, object):
4949
50 def __init__(self, server_address):50 def __init__(self, server_address):
51 super(FakeSearchServer, self).__init__(51 super(FakeSearchServer, self).__init__(
@@ -102,7 +102,7 @@
102 }102 }
103103
104 def do_GET(self):104 def do_GET(self):
105 parsed_path = urlparse.urlparse(self.path)105 parsed_path = urllib.parse.urlparse(self.path)
106 if parsed_path.path.startswith(self._SEARCH_PATH):106 if parsed_path.path.startswith(self._SEARCH_PATH):
107 self.send_json_reply(200, self._get_fake_search_response())107 self.send_json_reply(200, self._get_fake_search_response())
108 elif parsed_path.path.startswith('/extra/'):108 elif parsed_path.path.startswith('/extra/'):
@@ -131,7 +131,7 @@
131 raise NotImplementedError(package)131 raise NotImplementedError(package)
132132
133133
134class FakeDownloadServer(BaseHTTPServer.HTTPServer, object):134class FakeDownloadServer(http.server.HTTPServer, object):
135135
136 def __init__(self, server_address):136 def __init__(self, server_address):
137 super(FakeDownloadServer, self).__init__(137 super(FakeDownloadServer, self).__init__(
@@ -141,7 +141,7 @@
141class FakeDownloadRequestHandler(BaseFakeHTTPRequestHandler):141class FakeDownloadRequestHandler(BaseFakeHTTPRequestHandler):
142142
143 def do_HEAD(self):143 def do_HEAD(self):
144 parsed_path = urlparse.urlparse(self.path)144 parsed_path = urllib.parse.urlparse(self.path)
145 if parsed_path.path.startswith('/download/'):145 if parsed_path.path.startswith('/download/'):
146 self._send_dummy_file_headers(parsed_path.path[10:])146 self._send_dummy_file_headers(parsed_path.path[10:])
147 else:147 else:
@@ -156,7 +156,7 @@
156 def _make_dummy_file(self, name):156 def _make_dummy_file(self, name):
157 dummy_file = tempfile.NamedTemporaryFile(157 dummy_file = tempfile.NamedTemporaryFile(
158 prefix='dummy', suffix='.click', delete=False)158 prefix='dummy', suffix='.click', delete=False)
159 dummy_file.write('Dummy click file.')159 dummy_file.write('Dummy click file.'.encode())
160 dummy_file.write(name)160 dummy_file.write(name.encode())
161 dummy_file.close()161 dummy_file.close()
162 return dummy_file.name162 return dummy_file.name
163163
=== modified file 'autopilot/unityclickscope/test_click_scope.py'
--- autopilot/unityclickscope/test_click_scope.py 2014-05-13 05:52:34 +0000
+++ autopilot/unityclickscope/test_click_scope.py 2014-05-16 17:20:07 +0000
@@ -15,14 +15,15 @@
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import logging17import logging
18import os
19import shutil
18import subprocess20import subprocess
19import os
2021
21import dbusmock22import dbusmock
22import fixtures23import fixtures
23from autopilot.introspection import dbus as autopilot_dbus24from autopilot.introspection import dbus as autopilot_dbus
24from autopilot.matchers import Eventually25from autopilot.matchers import Eventually
25from testtools.matchers import Equals, MatchesAny26from testtools.matchers import Equals
26from unity8 import process_helpers27from unity8 import process_helpers
27from unity8.shell import tests as unity_tests28from unity8.shell import tests as unity_tests
28from unity8.shell.emulators import dash29from unity8.shell.emulators import dash
@@ -106,15 +107,40 @@
106 def _restart_scope(self):107 def _restart_scope(self):
107 logging.info('Restarting click scope.')108 logging.info('Restarting click scope.')
108 os.system('pkill -f -9 clickscope.ini')109 os.system('pkill -f -9 clickscope.ini')
109 lib_path = '/usr/lib/$DEB_HOST_MULTIARCH/'
110 scoperunner_path = os.path.join(lib_path, 'unity-scopes/scoperunner')
111 clickscope_config_ini_path = os.path.join(
112 lib_path, 'unity-scopes/clickscope/clickscope.ini')
113 os.system(110 os.system(
114 "dpkg-architecture -c "111 "dpkg-architecture -c "
115 "'{scoperunner} \"\" {clickscope}' &".format(112 "'{scoperunner} \"\" {clickscope}' &".format(
116 scoperunner=scoperunner_path,113 scoperunner=self._get_scoperunner_path(),
117 clickscope=clickscope_config_ini_path))114 clickscope=self._get_scope_ini_path()))
115
116 def _get_scoperunner_path(self):
117 return os.path.join(
118 self._get_installed_unity_scopes_lib_dir(), 'scoperunner')
119
120 def _get_installed_unity_scopes_lib_dir(self):
121 return os.path.join('/usr/lib/$DEB_HOST_MULTIARCH/', 'unity-scopes')
122
123 def _get_scope_ini_path(self):
124 build_dir = os.environ.get('BUILD_DIR', None)
125 if build_dir is not None:
126 return self._get_built_scope_ini_path(build_dir)
127 else:
128 return os.path.join(
129 self._get_installed_unity_scopes_lib_dir(),
130 'clickscope', 'clickscope.ini')
131
132 def _get_built_scope_ini_path(self, build_dir):
133 # The ini and the so files need to be on the same directory.
134 # We copy them to a temp directory.
135 temp_dir_fixture = fixtures.TempDir()
136 self.useFixture(temp_dir_fixture)
137 shutil.copy(
138 os.path.join(build_dir, 'data', 'clickscope.ini'),
139 temp_dir_fixture.path)
140 shutil.copy(
141 os.path.join(build_dir, 'scope', 'click', 'libclickscope.so'),
142 temp_dir_fixture.path)
143 return os.path.join(temp_dir_fixture.path, 'clickscope.ini')
118144
119 def _unlock_screen(self):145 def _unlock_screen(self):
120 self.main_window.get_greeter().swipe()146 self.main_window.get_greeter().swipe()
@@ -125,18 +151,10 @@
125 return scope151 return scope
126152
127 def search(self, query):153 def search(self, query):
128 # TODO move this to the unity8 main view emulator.
129 # --elopio - 2013-12-27
130 search_indicator = self._proxy.select_single(154 search_indicator = self._proxy.select_single(
131 'SearchIndicator', objectName='search')155 'SearchIndicator', objectName='search')
132 self.touch.tap_object(search_indicator)156 self.touch.tap_object(search_indicator)
133 page_header = self._proxy.select_single(157 self.dash.enter_search_query(query)
134 'PageHeader', objectName='pageHeader')
135 search_container = page_header.select_single(
136 'QQuickItem', objectName='searchContainer')
137 search_container.state.wait_for(
138 MatchesAny(Equals('narrowActive'), Equals('active')))
139 self.keyboard.type(query)
140158
141 def open_app_preview(self, category, name):159 def open_app_preview(self, category, name):
142 self.search(name)160 self.search(name)
@@ -182,7 +200,6 @@
182class ClickScopeTestCaseWithCredentials(BaseClickScopeTestCase):200class ClickScopeTestCaseWithCredentials(BaseClickScopeTestCase):
183201
184 def setUp(self):202 def setUp(self):
185# self.skipTest('segfaults. TODO in following branches.')
186 self.add_u1_credentials()203 self.add_u1_credentials()
187 super(ClickScopeTestCaseWithCredentials, self).setUp()204 super(ClickScopeTestCaseWithCredentials, self).setUp()
188 self.scope = self.open_scope()205 self.scope = self.open_scope()
@@ -191,7 +208,12 @@
191 def add_u1_credentials(self):208 def add_u1_credentials(self):
192 account_manager = credentials.AccountManager()209 account_manager = credentials.AccountManager()
193 account = account_manager.add_u1_credentials(210 account = account_manager.add_u1_credentials(
194 'dummy@example.com', 'dummy')211 'dummy@example.com',
212 'name=Ubuntu+One+%40+bollo&'
213 'consumer_secret=*********&'
214 'token=**************&'
215 'consumer_key=*******&'
216 'token_secret=************')
195 self.addCleanup(account_manager.delete_account, account)217 self.addCleanup(account_manager.delete_account, account)
196218
197 def test_install_with_credentials_must_start_download(self):219 def test_install_with_credentials_must_start_download(self):
@@ -211,9 +233,13 @@
211233
212 def get_details(self):234 def get_details(self):
213 """Return the details of the application whose preview is open."""235 """Return the details of the application whose preview is open."""
214 card_header = self.select_single('CardHeader', objectName='cardHeader')236 header_widget = self.select_single('PreviewWidget', objectName='hdr')
237 title_label = header_widget.select_single(
238 'Label', objectName='titleLabel')
239 subtitle_label = header_widget.select_single(
240 'Label', objectName='subtitleLabel')
215 return dict(241 return dict(
216 title=card_header.title, subtitle=card_header.subtitle)242 title=title_label.text, subtitle=subtitle_label.text)
217243
218 def install(self):244 def install(self):
219 parent = self.get_parent()245 parent = self.get_parent()
220246
=== modified file 'autopilot/unityclickscope/test_fixture_setup.py'
--- autopilot/unityclickscope/test_fixture_setup.py 2014-01-28 05:21:19 +0000
+++ autopilot/unityclickscope/test_fixture_setup.py 2014-05-16 17:20:07 +0000
@@ -14,8 +14,8 @@
14# You should have received a copy of the GNU General Public License14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import httplib17import http.client
18import urlparse18import urllib.parse
1919
20import testscenarios20import testscenarios
21import testtools21import testtools
@@ -39,14 +39,14 @@
39 fake_server = self.fixture()39 fake_server = self.fixture()
40 self.addCleanup(self._assert_server_not_running)40 self.addCleanup(self._assert_server_not_running)
41 self.useFixture(fake_server)41 self.useFixture(fake_server)
42 self.netloc = urlparse.urlparse(fake_server.url).netloc42 self.netloc = urllib.parse.urlparse(fake_server.url).netloc
43 connection = httplib.HTTPConnection(self.netloc)43 connection = http.client.HTTPConnection(self.netloc)
44 self.addCleanup(connection.close)44 self.addCleanup(connection.close)
45 self._do_request(connection)45 self._do_request(connection)
46 self.assertEqual(connection.getresponse().status, 200)46 self.assertEqual(connection.getresponse().status, 200)
4747
48 def _assert_server_not_running(self):48 def _assert_server_not_running(self):
49 connection = httplib.HTTPConnection(self.netloc)49 connection = http.client.HTTPConnection(self.netloc)
50 self.assertRaises(Exception, self._do_request, connection)50 self.assertRaises(Exception, self._do_request, connection)
5151
52 def _do_request(self, connection):52 def _do_request(self, connection):
5353
=== modified file 'debian/control'
--- debian/control 2014-05-05 19:40:20 +0000
+++ debian/control 2014-05-16 17:20:07 +0000
@@ -39,12 +39,12 @@
39Package: unity-scope-click-autopilot39Package: unity-scope-click-autopilot
40Architecture: all40Architecture: all
41Depends: libautopilot-qt (>= 1.4),41Depends: libautopilot-qt (>= 1.4),
42 python-autopilot,42 python3-autopilot,
43 python-dbus,43 python3-dbus,
44 python-dbusmock,44 python3-dbusmock,
45 python-fixtures,45 python3-fixtures,
46 python-testscenarios,46 python3-testscenarios,
47 python-testtools,47 python3-testtools,
48 ubuntu-ui-toolkit-autopilot,48 ubuntu-ui-toolkit-autopilot,
49 unity8-autopilot,49 unity8-autopilot,
50 ${misc:Depends},50 ${misc:Depends},

Subscribers

People subscribed via source and target branches

to all changes: