Merge lp:~raoul-snyman/openlp/pep440 into lp:openlp
- pep440
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 2833 |
Proposed branch: | lp:~raoul-snyman/openlp/pep440 |
Merge into: | lp:openlp |
Diff against target: |
246 lines (+176/-3) 7 files modified
MANIFEST.in (+2/-0) openlp/core/ui/themeform.py (+1/-1) scripts/mp_update.py (+61/-0) setup.py (+3/-2) tests/functional/openlp_core/ui/media/test_systemplayer.py (+24/-0) tests/functional/openlp_core/ui/test_firsttimeform.py (+36/-0) tests/openlp_core/ui/test_themeform.py (+49/-0) |
To merge this branch: | bzr merge lp:~raoul-snyman/openlp/pep440 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tomas Groth | Approve | ||
Review via email: mp+354087@code.launchpad.net |
This proposal supersedes a proposal from 2018-08-27.
Commit message
Make our version number PEP 440 compliant and add a script for Jenkins to report back to a merge proposal.
Description of the change
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal | # |
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal | # |
This is a test
Raoul Snyman (raoul-snyman) : Posted in a previous version of this proposal | # |
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal | # |
=======
platform linux -- Python 3.6.5, pytest-3.6.2, py-1.5.3, pluggy-0.6.0
rootdir: /var/lib/
plugins: mock-1.7.1, cov-2.5.1
collected 1208 items / 14 errors
=======
ERROR collecting tests/functiona
tests/functiona
INDEX_PAGE = (TEST_PATH / 'wordproject_
/usr/lib/
with self.open(
/usr/lib/
opener=
/usr/lib/
return self._accessor.
/usr/lib/
return strfunc(
E FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/
___ ERROR collecting tests/functiona
tests/functiona
from openlp.
openlp/
from .mediaitem import MediaMediaItem
openlp/
CLAPPERBOARD = UiIcons(
openlp/
cls.load(cls)
openlp/
qta.
/usr/lib/
return _instance(
/usr/lib/
os.
E qtawesome.
__ ERROR collecting tests/functiona
tests/functiona
from openlp.
openlp/
from openlp.
openlp/
from .mediaitem import MediaMediaItem
openlp/
CLAPPERBOARD = UiIcons(
E AttributeError: 'UiIcons' object has no attribute 'clapperboard'
______ ERROR collecting tests/openlp_
ImportError while importing test module '/var/lib/
Hint: make sure your test modules/packages have valid Python ...
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal | # |
Tests failed, please see https:/
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal | # |
Tests failed, please see https:/
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal | # |
Tests failed, please see https:/
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal | # |
Tests passed!
Raoul Snyman (raoul-snyman) wrote : | # |
Linux tests passed!
Tomas Groth (tomasgroth) : | # |
Tim Bentley (trb143) : Posted in a previous version of this proposal | # |
Preview Diff
1 | === modified file 'MANIFEST.in' |
2 | --- MANIFEST.in 2014-05-05 17:31:45 +0000 |
3 | +++ MANIFEST.in 2018-08-31 05:56:04 +0000 |
4 | @@ -7,9 +7,11 @@ |
5 | recursive-include openlp *.png |
6 | recursive-include openlp *.ps |
7 | recursive-include openlp *.json |
8 | +recursive-include openlp *.ttf |
9 | recursive-include documentation * |
10 | recursive-include resources * |
11 | recursive-include scripts * |
12 | +recursive-include tests/resources * |
13 | include copyright.txt |
14 | include LICENSE |
15 | include README.txt |
16 | |
17 | === modified file 'openlp/core/ui/themeform.py' |
18 | --- openlp/core/ui/themeform.py 2018-08-25 14:08:19 +0000 |
19 | +++ openlp/core/ui/themeform.py 2018-08-31 05:56:04 +0000 |
20 | @@ -153,7 +153,7 @@ |
21 | Calculate the number of lines on a page by rendering text |
22 | """ |
23 | # Do not trigger on start up |
24 | - if self.currentPage != self.welcome_page: |
25 | + if self.currentPage() != self.welcome_page: |
26 | self.update_theme() |
27 | self.theme_manager.generate_image(self.theme, True) |
28 | |
29 | |
30 | === added file 'scripts/mp_update.py' |
31 | --- scripts/mp_update.py 1970-01-01 00:00:00 +0000 |
32 | +++ scripts/mp_update.py 2018-08-31 05:56:04 +0000 |
33 | @@ -0,0 +1,61 @@ |
34 | +#!/usr/bin/env python2 |
35 | +import sys |
36 | +import os |
37 | +from argparse import ArgumentParser |
38 | +from launchpadlib.credentials import UnencryptedFileCredentialStore |
39 | +from launchpadlib.launchpad import Launchpad |
40 | + |
41 | +HERE = os.path.dirname(os.path.abspath(__file__)) |
42 | + |
43 | + |
44 | +def parse_args(): |
45 | + """ |
46 | + Parse the command line arguments |
47 | + """ |
48 | + parser = ArgumentParser() |
49 | + parser.add_argument('-p', '--merge-proposal', required=True, |
50 | + help='The main part of the URL to the merge proposal, without the hostname.') |
51 | + parser.add_argument('-m', '--message', required=True, |
52 | + help='The comment to add to the merge proposal') |
53 | + parser.add_argument('-s', '--subject', default=None, help='The subject for the comment') |
54 | + return parser.parse_args() |
55 | + |
56 | + |
57 | +def get_merge_proposal(merge_proposal_url): |
58 | + """ |
59 | + Get the merge proposal for the ``merge_proposal_url`` |
60 | + """ |
61 | + lp = Launchpad.login_with('OpenLP CI', 'production', version='devel', |
62 | + credential_store=UnencryptedFileCredentialStore(os.path.join(HERE, 'launchpadcreds.txt'))) |
63 | + openlp_project = lp.projects['openlp'] |
64 | + merge_proposals = openlp_project.getMergeProposals() |
65 | + for merge_proposal in merge_proposals: |
66 | + if str(merge_proposal).endswith(merge_proposal_url): |
67 | + return merge_proposal |
68 | + return None |
69 | + |
70 | + |
71 | +def create_comment(merge_proposal, comment, subject): |
72 | + """ |
73 | + Create a comment on the merge proposal |
74 | + """ |
75 | + if not subject: |
76 | + subject = 'Jenkins test update' |
77 | + merge_proposal.createComment(subject=subject, content=comment) |
78 | + |
79 | + |
80 | +def main(): |
81 | + """ |
82 | + Run the thing |
83 | + """ |
84 | + args = parse_args() |
85 | + merge_proposal = get_merge_proposal(args.merge_proposal) |
86 | + if not merge_proposal: |
87 | + print('No merge proposal with that URL found') |
88 | + sys.exit(1) |
89 | + else: |
90 | + create_comment(merge_proposal, args.message, args.subject) |
91 | + |
92 | + |
93 | +if __name__ == '__main__': |
94 | + main() |
95 | |
96 | === modified file 'setup.py' |
97 | --- setup.py 2017-12-29 09:15:48 +0000 |
98 | +++ setup.py 2018-08-31 05:56:04 +0000 |
99 | @@ -99,10 +99,11 @@ |
100 | if tree_revision == tag_revision: |
101 | version_string = tag_version.decode('utf-8') |
102 | else: |
103 | - version_string = '%s-bzr%s' % (tag_version.decode('utf-8'), tree_revision.decode('utf-8')) |
104 | + version_string = '{version}.dev{revision}'.format(version=tag_version.decode('utf-8'), |
105 | + revision=tree_revision.decode('utf-8')) |
106 | ver_file = open(VERSION_FILE, 'w') |
107 | ver_file.write(version_string) |
108 | -except: |
109 | +except Exception: |
110 | ver_file = open(VERSION_FILE, 'r') |
111 | version_string = ver_file.read().strip() |
112 | finally: |
113 | |
114 | === modified file 'tests/functional/openlp_core/ui/media/test_systemplayer.py' |
115 | --- tests/functional/openlp_core/ui/media/test_systemplayer.py 2018-01-07 18:07:22 +0000 |
116 | +++ tests/functional/openlp_core/ui/media/test_systemplayer.py 2018-08-31 05:56:04 +0000 |
117 | @@ -508,6 +508,30 @@ |
118 | # THEN: The correct values should be set up |
119 | assert worker is not None |
120 | |
121 | + @patch('openlp.core.ui.media.systemplayer.functools.partial') |
122 | + @patch('openlp.core.ui.media.systemplayer.QtMultimedia.QMediaContent') |
123 | + def test_start(self, MockQMediaContent, mocked_partial): |
124 | + """ |
125 | + Test the start method |
126 | + """ |
127 | + # GIVEN: A CheckMediaWorker instance |
128 | + worker = CheckMediaWorker('file.ogv') |
129 | + MockQMediaContent.side_effect = lambda x: x |
130 | + mocked_partial.side_effect = lambda x, y: y |
131 | + |
132 | + # WHEN: start() is called |
133 | + with patch.object(worker, 'error') as mocked_error, \ |
134 | + patch.object(worker, 'mediaStatusChanged') as mocked_status_change, \ |
135 | + patch.object(worker, 'setMedia') as mocked_set_media, \ |
136 | + patch.object(worker, 'play') as mocked_play: |
137 | + worker.start() |
138 | + |
139 | + # THEN: The correct methods should be called |
140 | + mocked_error.connect.assert_called_once_with('error') |
141 | + mocked_status_change.connect.assert_called_once_with('media') |
142 | + mocked_set_media.assert_called_once_with(QtCore.QUrl('file:file.ogv')) |
143 | + mocked_play.assert_called_once_with() |
144 | + |
145 | def test_signals_media(self): |
146 | """ |
147 | Test the signals() signal of the CheckMediaWorker class with a "media" origin |
148 | |
149 | === modified file 'tests/functional/openlp_core/ui/test_firsttimeform.py' |
150 | --- tests/functional/openlp_core/ui/test_firsttimeform.py 2018-01-04 06:10:20 +0000 |
151 | +++ tests/functional/openlp_core/ui/test_firsttimeform.py 2018-08-31 05:56:04 +0000 |
152 | @@ -233,3 +233,39 @@ |
153 | mocked_message_box.critical.assert_called_once_with( |
154 | first_time_form, 'Network Error', 'There was a network error attempting to connect to retrieve ' |
155 | 'initial configuration information', 'OK') |
156 | + |
157 | + @patch('openlp.core.ui.firsttimewizard.Settings') |
158 | + def test_on_projectors_check_box_checked(self, MockSettings): |
159 | + """ |
160 | + Test that the projector panel is shown when the checkbox in the first time wizard is checked |
161 | + """ |
162 | + # GIVEN: A First Time Wizard and a mocked settings object |
163 | + frw = FirstTimeForm(None) |
164 | + mocked_settings = MagicMock() |
165 | + mocked_settings.value.return_value = True |
166 | + MockSettings.return_value = mocked_settings |
167 | + |
168 | + # WHEN: on_projectors_check_box_clicked() is called |
169 | + frw.on_projectors_check_box_clicked() |
170 | + |
171 | + # THEN: The visibility of the projects panel should have been set |
172 | + mocked_settings.value.assert_called_once_with('projector/show after wizard') |
173 | + mocked_settings.setValue.assert_called_once_with('projector/show after wizard', False) |
174 | + |
175 | + @patch('openlp.core.ui.firsttimewizard.Settings') |
176 | + def test_on_projectors_check_box_unchecked(self, MockSettings): |
177 | + """ |
178 | + Test that the projector panel is shown when the checkbox in the first time wizard is checked |
179 | + """ |
180 | + # GIVEN: A First Time Wizard and a mocked settings object |
181 | + frw = FirstTimeForm(None) |
182 | + mocked_settings = MagicMock() |
183 | + mocked_settings.value.return_value = False |
184 | + MockSettings.return_value = mocked_settings |
185 | + |
186 | + # WHEN: on_projectors_check_box_clicked() is called |
187 | + frw.on_projectors_check_box_clicked() |
188 | + |
189 | + # THEN: The visibility of the projects panel should have been set |
190 | + mocked_settings.value.assert_called_once_with('projector/show after wizard') |
191 | + mocked_settings.setValue.assert_called_once_with('projector/show after wizard', True) |
192 | |
193 | === added directory 'tests/openlp_core/ui' |
194 | === added file 'tests/openlp_core/ui/test_themeform.py' |
195 | --- tests/openlp_core/ui/test_themeform.py 1970-01-01 00:00:00 +0000 |
196 | +++ tests/openlp_core/ui/test_themeform.py 2018-08-31 05:56:04 +0000 |
197 | @@ -0,0 +1,49 @@ |
198 | +# -*- coding: utf-8 -*- |
199 | +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 |
200 | + |
201 | +############################################################################### |
202 | +# OpenLP - Open Source Lyrics Projection # |
203 | +# --------------------------------------------------------------------------- # |
204 | +# Copyright (c) 2008-2018 OpenLP Developers # |
205 | +# --------------------------------------------------------------------------- # |
206 | +# This program is free software; you can redistribute it and/or modify it # |
207 | +# under the terms of the GNU General Public License as published by the Free # |
208 | +# Software Foundation; version 2 of the License. # |
209 | +# # |
210 | +# This program is distributed in the hope that it will be useful, but WITHOUT # |
211 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # |
212 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # |
213 | +# more details. # |
214 | +# # |
215 | +# You should have received a copy of the GNU General Public License along # |
216 | +# with this program; if not, write to the Free Software Foundation, Inc., 59 # |
217 | +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # |
218 | +############################################################################### |
219 | +""" |
220 | +Interface tests to test the ThemeWizard class and related methods. |
221 | +""" |
222 | +from unittest import TestCase |
223 | + |
224 | +from openlp.core.common.registry import Registry |
225 | +from openlp.core.ui.themeform import ThemeForm |
226 | +from tests.helpers.testmixin import TestMixin |
227 | + |
228 | + |
229 | +class TestThemeManager(TestCase, TestMixin): |
230 | + """ |
231 | + Test the functions in the ThemeManager module |
232 | + """ |
233 | + def setUp(self): |
234 | + """ |
235 | + Create the UI |
236 | + """ |
237 | + Registry.create() |
238 | + |
239 | + def test_create_theme_wizard(self): |
240 | + """ |
241 | + Test creating a ThemeForm instance |
242 | + """ |
243 | + # GIVEN: A ThemeForm class |
244 | + # WHEN: An object is created |
245 | + # THEN: There should be no problems |
246 | + ThemeForm(None) |
This is a test comment