Merge lp:~ubuntu-testcase/ubuntu-community-testing/add_and_package_script into lp:ubuntu-community-testing

Proposed by Brendan Donegan
Status: Needs review
Proposed branch: lp:~ubuntu-testcase/ubuntu-community-testing/add_and_package_script
Merge into: lp:ubuntu-community-testing
Diff against target: 311 lines (+215/-1)
13 files modified
.bzr-builddeb/default.conf (+2/-0)
README (+17/-0)
debian/changelog (+5/-0)
debian/compat (+1/-0)
debian/control (+23/-0)
debian/copyright (+21/-0)
debian/docs (+1/-0)
debian/rules (+12/-0)
debian/source/format (+1/-0)
setup.py (+43/-0)
ubuntu_community_testing/__init__.py (+17/-0)
ubuntu_community_testing/ubuntu_community_testing.py (+66/-0)
ubuntu_community_testing/upload_results.py (+6/-1)
To merge this branch: bzr merge lp:~ubuntu-testcase/ubuntu-community-testing/add_and_package_script
Reviewer Review Type Date Requested Status
Ubuntu Testcase Admins Pending
Review via email: mp+268654@code.launchpad.net

Description of the change

Do a bit of refactoring of the project layout so the web-service is in its own directory and tools are in a separate one. More importantly, add a script called ubuntu-community-testing which wraps the process of getting the Checkbox provider from people.canonical.com and running Checkbox with it.

This still needs debian packaging for the tools. The debian package should install both tools and the required dependencies (mainly checkbox-converged-community). Once packaged it can be built in the ubuntu-testcase/community-testing PPA

To post a comment you must log in.

Unmerged revisions

35. By Christopher Lee

Update copyright file from where I pilfered it from.

34. By Christopher Lee

Add checkbox-converged-community to depends.

33. By Christopher Lee

Adding initial packaging w/ slight shuffle around.

32. By Christopher Lee

Fix syntax and flake8 errors

31. By Brendan Donegan

Add ubuntu-community-testing wrapper script

30. By Brendan Donegan

Adding upload script and re-arranging codebase

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.bzr-builddeb'
2=== added file '.bzr-builddeb/default.conf'
3--- .bzr-builddeb/default.conf 1970-01-01 00:00:00 +0000
4+++ .bzr-builddeb/default.conf 2015-08-21 05:49:27 +0000
5@@ -0,0 +1,2 @@
6+[BUILDDEB]
7+split = true
8
9=== added file 'README'
10--- README 1970-01-01 00:00:00 +0000
11+++ README 2015-08-21 05:49:27 +0000
12@@ -0,0 +1,17 @@
13+This project contains too important pieces of the Community Testing Project.
14+
15+Web Service
16+-----------
17+Found in ./web-service, this isn't packaged or released as it is consumed using Mojo/Juju and is the server component.
18+
19+Tools
20+-----
21+Found in ./ubuntu_community_testing
22+These are the user tools for the community testing:
23+ - ubuntu_community_testing
24+ - This script is used to pull down tests and run them through checkbox
25+ - upload_results
26+ - This script is used to manually upload results to the web service (generally done by checkbox though).
27+
28+NOTE: This project relies on the PPA ppa:ubuntu-testcase/community-testing for the checkbox package: checkbox-converged-community.
29+ Please install this PPA before installing the ubuntu-community-testing package.
30
31=== added directory 'debian'
32=== added file 'debian/changelog'
33--- debian/changelog 1970-01-01 00:00:00 +0000
34+++ debian/changelog 2015-08-21 05:49:27 +0000
35@@ -0,0 +1,5 @@
36+ubuntu-community-testing (1.0-1) UNRELEASED; urgency=medium
37+
38+ * Initial packaging release.
39+
40+ -- Christopher Lee <chris.lee@canonical.com> Mon, 17 Aug 2015 18:27:41 +1200
41
42=== added file 'debian/compat'
43--- debian/compat 1970-01-01 00:00:00 +0000
44+++ debian/compat 2015-08-21 05:49:27 +0000
45@@ -0,0 +1,1 @@
46+9
47
48=== added file 'debian/control'
49--- debian/control 1970-01-01 00:00:00 +0000
50+++ debian/control 2015-08-21 05:49:27 +0000
51@@ -0,0 +1,23 @@
52+Source: ubuntu-community-testing
53+Section: python
54+Priority: optional
55+Maintainer: Christopher Lee <chris.lee@canonical.com>
56+Build-Depends: debhelper (>= 9),
57+ dh-python,
58+ python3-all-dev (>= 3.4),
59+ python3-setuptools,
60+ python3-flake8,
61+Standards-Version: 3.9.5
62+Homepage: http://launchpad.net/ubuntu-community-testing
63+X-Python3-Version: >= 3.3
64+
65+Package: ubuntu-community-testing
66+Architecture: all
67+Depends: ${misc:Depends},
68+ ${python3:Depends},
69+ python3-requests,
70+ python3-oauthlib,
71+ python3-urllib3,
72+ checkbox-converged-community,
73+Description: Tools for operating with the Ubuntu Community Testing.
74+ Tools for pushing results and pulling new testsuites with the Ubuntu Community Testing system.
75\ No newline at end of file
76
77=== added file 'debian/copyright'
78--- debian/copyright 1970-01-01 00:00:00 +0000
79+++ debian/copyright 2015-08-21 05:49:27 +0000
80@@ -0,0 +1,21 @@
81+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
82+Upstream-Name: ubuntu-community-testing
83+Source: http://launchpad.net/ubuntu-community-testing
84+
85+Files: *
86+Copyright: 2015 Canonical
87+License: GPL-3.0
88+ This program is free software: you can redistribute it and/or modify
89+ it under the terms of the GNU General Public License as published by
90+ the Free Software Foundation, version 3 of the License.
91+ .
92+ This package is distributed in the hope that it will be useful,
93+ but WITHOUT ANY WARRANTY; without even the implied warranty of
94+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95+ GNU General Public License for more details.
96+ .
97+ You should have received a copy of the GNU General Public License
98+ along with this program. If not, see <http://www.gnu.org/licenses/>.
99+ .
100+ On Debian systems, the complete text of the GNU General
101+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
102\ No newline at end of file
103
104=== added file 'debian/docs'
105--- debian/docs 1970-01-01 00:00:00 +0000
106+++ debian/docs 2015-08-21 05:49:27 +0000
107@@ -0,0 +1,1 @@
108+README
109
110=== added file 'debian/rules'
111--- debian/rules 1970-01-01 00:00:00 +0000
112+++ debian/rules 2015-08-21 05:49:27 +0000
113@@ -0,0 +1,12 @@
114+#!/usr/bin/make -f
115+# -*- makefile -*-
116+
117+# Uncomment this to turn on verbose mode.
118+# export DH_VERBOSE=1
119+
120+%:
121+ dh $@ --with python3 --buildsystem=pybuild
122+
123+override_dh_auto_build:
124+ python3 -m flake8.run tools/
125+ dh_auto_build
126
127=== added directory 'debian/source'
128=== added file 'debian/source/format'
129--- debian/source/format 1970-01-01 00:00:00 +0000
130+++ debian/source/format 2015-08-21 05:49:27 +0000
131@@ -0,0 +1,1 @@
132+3.0 (quilt)
133
134=== added file 'setup.py'
135--- setup.py 1970-01-01 00:00:00 +0000
136+++ setup.py 2015-08-21 05:49:27 +0000
137@@ -0,0 +1,43 @@
138+#!/usr/bin/env python
139+
140+#
141+# Ubuntu PractiTest Community
142+# Copyright (C) 2015 Canonical
143+#
144+# This program is free software: you can redistribute it and/or modify
145+# it under the terms of the GNU General Public License as published by
146+# the Free Software Foundation, either version 3 of the License, or
147+# (at your option) any later version.
148+#
149+# This program is distributed in the hope that it will be useful,
150+# but WITHOUT ANY WARRANTY; without even the implied warranty of
151+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
152+# GNU General Public License for more details.
153+#
154+# You should have received a copy of the GNU General Public License
155+# along with this program. If not, see <http://www.gnu.org/licenses/>.
156+#
157+
158+import sys
159+assert sys.version_info >= (3,), 'Python 3 is required'
160+
161+from setuptools import setup, find_packages
162+
163+setup(
164+ name='ubuntu-community-testing',
165+ version='0.1',
166+ description='Gets tests, runs them using Checkbox and uploads the results.',
167+ packages=find_packages(),
168+ install_requires=[
169+ 'requests',
170+ 'oauthlib'
171+ ],
172+ entry_points={
173+ 'console_scripts': [
174+ ('upload-community-results = '
175+ 'ubuntu_community_testing.upload_results:main'),
176+ ('ubuntu-community-testing = '
177+ 'ubuntu_community_testing.ubuntu_community_testing:main'),
178+ ]
179+ }
180+)
181
182=== removed directory 'tools'
183=== added directory 'ubuntu_community_testing'
184=== added file 'ubuntu_community_testing/__init__.py'
185--- ubuntu_community_testing/__init__.py 1970-01-01 00:00:00 +0000
186+++ ubuntu_community_testing/__init__.py 2015-08-21 05:49:27 +0000
187@@ -0,0 +1,17 @@
188+#
189+# Ubuntu Community Testing
190+# Copyright (C) 2015 Canonical
191+#
192+# This program is free software: you can redistribute it and/or modify
193+# it under the terms of the GNU General Public License as published by
194+# the Free Software Foundation, either version 3 of the License, or
195+# (at your option) any later version.
196+#
197+# This program is distributed in the hope that it will be useful,
198+# but WITHOUT ANY WARRANTY; without even the implied warranty of
199+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
200+# GNU General Public License for more details.
201+#
202+# You should have received a copy of the GNU General Public License
203+# along with this program. If not, see <http://www.gnu.org/licenses/>.
204+#
205
206=== added file 'ubuntu_community_testing/ubuntu_community_testing.py'
207--- ubuntu_community_testing/ubuntu_community_testing.py 1970-01-01 00:00:00 +0000
208+++ ubuntu_community_testing/ubuntu_community_testing.py 2015-08-21 05:49:27 +0000
209@@ -0,0 +1,66 @@
210+#
211+# Ubuntu PractiTest Community test runner
212+# Copyright (C) 2015 Canonical
213+#
214+# This program is free software: you can redistribute it and/or modify
215+# it under the terms of the GNU General Public License as published by
216+# the Free Software Foundation, either version 3 of the License, or
217+# (at your option) any later version.
218+#
219+# This program is distributed in the hope that it will be useful,
220+# but WITHOUT ANY WARRANTY; without even the implied warranty of
221+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
222+# GNU General Public License for more details.
223+#
224+# You should have received a copy of the GNU General Public License
225+# along with this program. If not, see <http://www.gnu.org/licenses/>.
226+#
227+
228+"""Script to receive tests, run them and upload the results."""
229+
230+import os
231+import sys
232+import tempfile
233+import urllib.request
234+import zipfile
235+
236+from argparse import ArgumentParser
237+from subprocess import check_call, CalledProcessError
238+
239+TESTSET_LOCATION = ('http://people.canonical.com/'
240+ '~platform-qa/checkbox_providers/')
241+
242+
243+def download_and_extract_testset(filename):
244+ url = TESTSET_LOCATION + filename
245+ tempdir = tempfile.mkdtemp()
246+ r = urllib.request.urlretrieve(url, os.path.join(tempdir, filename))
247+ # Now we extract the provider from the zip
248+ providerzip = open(r[0], 'rb')
249+ z = zipfile.ZipFile(providerzip)
250+ for name in z.namelist():
251+ z.extract(name, tempdir)
252+ return tempdir
253+
254+
255+def main():
256+ parser = ArgumentParser(
257+ 'Receive tests, run them in Checkbox and upload the results.'
258+ )
259+ parser.add_argument(
260+ '--testset',
261+ default='current',
262+ help='The testset to run'
263+ )
264+ args = parser.parse_args()
265+ providerpath = download_and_extract_testset(args.testset + '.zip')
266+ try:
267+ check_call(
268+ 'PROVIDERPATH={} checkbox-touch-community'.format(providerpath),
269+ shell=True
270+ )
271+ except CalledProcessError as err:
272+ print(err)
273+
274+if __name__ == "__main__":
275+ sys.exit(main())
276
277=== renamed file 'tools/upload_results.py' => 'ubuntu_community_testing/upload_results.py'
278--- tools/upload_results.py 2015-08-18 03:45:23 +0000
279+++ ubuntu_community_testing/upload_results.py 2015-08-21 05:49:27 +0000
280@@ -21,6 +21,7 @@
281 # For example if you're running the runserver.py script:
282 # python3 upload_results.py <path to json file> http://localhost:5000/v1/upload
283
284+import sys
285 import argparse
286 import json
287 import requests
288@@ -140,7 +141,7 @@
289 return (args.file, args.url, args.email, args.staging)
290
291
292-if __name__ == '__main__':
293+def main():
294 file_path, url, email, use_staging = get_upload_details()
295
296 if use_staging:
297@@ -173,3 +174,7 @@
298 # Right, now we can post the details.
299 requests.post(url, files=upload_data, data=form_data, headers=headers)
300 print('Upload succeeded')
301+
302+
303+if __name__ == '__main__':
304+ sys.exit(main())
305
306=== added directory 'web-service'
307=== renamed file 'README' => 'web-service/README'
308=== renamed file 'requirements.txt' => 'web-service/requirements.txt'
309=== renamed file 'runserver.py' => 'web-service/runserver.py'
310=== renamed file 'setup.py' => 'web-service/setup.py'
311=== renamed directory 'ubuntu_pt_community' => 'web-service/ubuntu_pt_community'

Subscribers

People subscribed via source and target branches