openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #33026
[Merge] lp:~raoul-snyman/openlp/pep440 into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/pep440 into lp:openlp.
Commit message:
Make our version number PEP 440 compliant and add a script for Jenkins to report back to a merge proposal.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/pep440/+merge/354087
--
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/pep440 into lp:openlp.
=== modified file 'MANIFEST.in'
--- MANIFEST.in 2014-05-05 17:31:45 +0000
+++ MANIFEST.in 2018-08-31 05:56:04 +0000
@@ -7,9 +7,11 @@
recursive-include openlp *.png
recursive-include openlp *.ps
recursive-include openlp *.json
+recursive-include openlp *.ttf
recursive-include documentation *
recursive-include resources *
recursive-include scripts *
+recursive-include tests/resources *
include copyright.txt
include LICENSE
include README.txt
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py 2018-08-25 14:08:19 +0000
+++ openlp/core/ui/themeform.py 2018-08-31 05:56:04 +0000
@@ -153,7 +153,7 @@
Calculate the number of lines on a page by rendering text
"""
# Do not trigger on start up
- if self.currentPage != self.welcome_page:
+ if self.currentPage() != self.welcome_page:
self.update_theme()
self.theme_manager.generate_image(self.theme, True)
=== added file 'scripts/mp_update.py'
--- scripts/mp_update.py 1970-01-01 00:00:00 +0000
+++ scripts/mp_update.py 2018-08-31 05:56:04 +0000
@@ -0,0 +1,61 @@
+#!/usr/bin/env python2
+import sys
+import os
+from argparse import ArgumentParser
+from launchpadlib.credentials import UnencryptedFileCredentialStore
+from launchpadlib.launchpad import Launchpad
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+
+
+def parse_args():
+ """
+ Parse the command line arguments
+ """
+ parser = ArgumentParser()
+ parser.add_argument('-p', '--merge-proposal', required=True,
+ help='The main part of the URL to the merge proposal, without the hostname.')
+ parser.add_argument('-m', '--message', required=True,
+ help='The comment to add to the merge proposal')
+ parser.add_argument('-s', '--subject', default=None, help='The subject for the comment')
+ return parser.parse_args()
+
+
+def get_merge_proposal(merge_proposal_url):
+ """
+ Get the merge proposal for the ``merge_proposal_url``
+ """
+ lp = Launchpad.login_with('OpenLP CI', 'production', version='devel',
+ credential_store=UnencryptedFileCredentialStore(os.path.join(HERE, 'launchpadcreds.txt')))
+ openlp_project = lp.projects['openlp']
+ merge_proposals = openlp_project.getMergeProposals()
+ for merge_proposal in merge_proposals:
+ if str(merge_proposal).endswith(merge_proposal_url):
+ return merge_proposal
+ return None
+
+
+def create_comment(merge_proposal, comment, subject):
+ """
+ Create a comment on the merge proposal
+ """
+ if not subject:
+ subject = 'Jenkins test update'
+ merge_proposal.createComment(subject=subject, content=comment)
+
+
+def main():
+ """
+ Run the thing
+ """
+ args = parse_args()
+ merge_proposal = get_merge_proposal(args.merge_proposal)
+ if not merge_proposal:
+ print('No merge proposal with that URL found')
+ sys.exit(1)
+ else:
+ create_comment(merge_proposal, args.message, args.subject)
+
+
+if __name__ == '__main__':
+ main()
=== modified file 'setup.py'
--- setup.py 2017-12-29 09:15:48 +0000
+++ setup.py 2018-08-31 05:56:04 +0000
@@ -99,10 +99,11 @@
if tree_revision == tag_revision:
version_string = tag_version.decode('utf-8')
else:
- version_string = '%s-bzr%s' % (tag_version.decode('utf-8'), tree_revision.decode('utf-8'))
+ version_string = '{version}.dev{revision}'.format(version=tag_version.decode('utf-8'),
+ revision=tree_revision.decode('utf-8'))
ver_file = open(VERSION_FILE, 'w')
ver_file.write(version_string)
-except:
+except Exception:
ver_file = open(VERSION_FILE, 'r')
version_string = ver_file.read().strip()
finally:
=== modified file 'tests/functional/openlp_core/ui/media/test_systemplayer.py'
--- tests/functional/openlp_core/ui/media/test_systemplayer.py 2018-01-07 18:07:22 +0000
+++ tests/functional/openlp_core/ui/media/test_systemplayer.py 2018-08-31 05:56:04 +0000
@@ -508,6 +508,30 @@
# THEN: The correct values should be set up
assert worker is not None
+ @patch('openlp.core.ui.media.systemplayer.functools.partial')
+ @patch('openlp.core.ui.media.systemplayer.QtMultimedia.QMediaContent')
+ def test_start(self, MockQMediaContent, mocked_partial):
+ """
+ Test the start method
+ """
+ # GIVEN: A CheckMediaWorker instance
+ worker = CheckMediaWorker('file.ogv')
+ MockQMediaContent.side_effect = lambda x: x
+ mocked_partial.side_effect = lambda x, y: y
+
+ # WHEN: start() is called
+ with patch.object(worker, 'error') as mocked_error, \
+ patch.object(worker, 'mediaStatusChanged') as mocked_status_change, \
+ patch.object(worker, 'setMedia') as mocked_set_media, \
+ patch.object(worker, 'play') as mocked_play:
+ worker.start()
+
+ # THEN: The correct methods should be called
+ mocked_error.connect.assert_called_once_with('error')
+ mocked_status_change.connect.assert_called_once_with('media')
+ mocked_set_media.assert_called_once_with(QtCore.QUrl('file:file.ogv'))
+ mocked_play.assert_called_once_with()
+
def test_signals_media(self):
"""
Test the signals() signal of the CheckMediaWorker class with a "media" origin
=== modified file 'tests/functional/openlp_core/ui/test_firsttimeform.py'
--- tests/functional/openlp_core/ui/test_firsttimeform.py 2018-01-04 06:10:20 +0000
+++ tests/functional/openlp_core/ui/test_firsttimeform.py 2018-08-31 05:56:04 +0000
@@ -233,3 +233,39 @@
mocked_message_box.critical.assert_called_once_with(
first_time_form, 'Network Error', 'There was a network error attempting to connect to retrieve '
'initial configuration information', 'OK')
+
+ @patch('openlp.core.ui.firsttimewizard.Settings')
+ def test_on_projectors_check_box_checked(self, MockSettings):
+ """
+ Test that the projector panel is shown when the checkbox in the first time wizard is checked
+ """
+ # GIVEN: A First Time Wizard and a mocked settings object
+ frw = FirstTimeForm(None)
+ mocked_settings = MagicMock()
+ mocked_settings.value.return_value = True
+ MockSettings.return_value = mocked_settings
+
+ # WHEN: on_projectors_check_box_clicked() is called
+ frw.on_projectors_check_box_clicked()
+
+ # THEN: The visibility of the projects panel should have been set
+ mocked_settings.value.assert_called_once_with('projector/show after wizard')
+ mocked_settings.setValue.assert_called_once_with('projector/show after wizard', False)
+
+ @patch('openlp.core.ui.firsttimewizard.Settings')
+ def test_on_projectors_check_box_unchecked(self, MockSettings):
+ """
+ Test that the projector panel is shown when the checkbox in the first time wizard is checked
+ """
+ # GIVEN: A First Time Wizard and a mocked settings object
+ frw = FirstTimeForm(None)
+ mocked_settings = MagicMock()
+ mocked_settings.value.return_value = False
+ MockSettings.return_value = mocked_settings
+
+ # WHEN: on_projectors_check_box_clicked() is called
+ frw.on_projectors_check_box_clicked()
+
+ # THEN: The visibility of the projects panel should have been set
+ mocked_settings.value.assert_called_once_with('projector/show after wizard')
+ mocked_settings.setValue.assert_called_once_with('projector/show after wizard', True)
=== added directory 'tests/openlp_core/ui'
=== added file 'tests/openlp_core/ui/test_themeform.py'
--- tests/openlp_core/ui/test_themeform.py 1970-01-01 00:00:00 +0000
+++ tests/openlp_core/ui/test_themeform.py 2018-08-31 05:56:04 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2018 OpenLP Developers #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+"""
+Interface tests to test the ThemeWizard class and related methods.
+"""
+from unittest import TestCase
+
+from openlp.core.common.registry import Registry
+from openlp.core.ui.themeform import ThemeForm
+from tests.helpers.testmixin import TestMixin
+
+
+class TestThemeManager(TestCase, TestMixin):
+ """
+ Test the functions in the ThemeManager module
+ """
+ def setUp(self):
+ """
+ Create the UI
+ """
+ Registry.create()
+
+ def test_create_theme_wizard(self):
+ """
+ Test creating a ThemeForm instance
+ """
+ # GIVEN: A ThemeForm class
+ # WHEN: An object is created
+ # THEN: There should be no problems
+ ThemeForm(None)
Follow ups