From 8fa9bdcf580f5842b87199a2bdafc01831eb0162 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 30 Nov 2017 15:15:11 -0700 Subject: [PATCH 1/6] Skip the test if not on Linux --- .../functional/openlp_plugins/songs/test_openoffice.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/functional/openlp_plugins/songs/test_openoffice.py b/tests/functional/openlp_plugins/songs/test_openoffice.py index 4172a553c..82cce6e10 100644 --- a/tests/functional/openlp_plugins/songs/test_openoffice.py +++ b/tests/functional/openlp_plugins/songs/test_openoffice.py @@ -25,12 +25,14 @@ This module contains tests for the OpenOffice/LibreOffice importer. from unittest import TestCase, SkipTest from unittest.mock import MagicMock, patch -from openlp.core.common.registry import Registry -try: - from openlp.plugins.songs.lib.importers.openoffice import OpenOfficeImport -except ImportError: +from openlp.core.common import is_linux + +if not is_linux: raise SkipTest('Could not import OpenOfficeImport probably due to unavailability of uno') +from openlp.core.common.registry import Registry +from openlp.plugins.songs.lib.importers.openoffice import OpenOfficeImport + from tests.helpers.testmixin import TestMixin From d9e2994deb6ec562e0c91cb4128eb968b31645de Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 30 Nov 2017 15:29:41 -0700 Subject: [PATCH 2/6] Actually run the function, ID10T --- tests/functional/openlp_plugins/songs/test_openoffice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/openlp_plugins/songs/test_openoffice.py b/tests/functional/openlp_plugins/songs/test_openoffice.py index 82cce6e10..e122da806 100644 --- a/tests/functional/openlp_plugins/songs/test_openoffice.py +++ b/tests/functional/openlp_plugins/songs/test_openoffice.py @@ -27,7 +27,7 @@ from unittest.mock import MagicMock, patch from openlp.core.common import is_linux -if not is_linux: +if not is_linux(): raise SkipTest('Could not import OpenOfficeImport probably due to unavailability of uno') from openlp.core.common.registry import Registry From b3669c4f5dd49c7b5ee2fc3033aedd7908854156 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 30 Nov 2017 15:46:03 -0700 Subject: [PATCH 3/6] Change things around a bit --- .../openlp_plugins/songs/test_openoffice.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/functional/openlp_plugins/songs/test_openoffice.py b/tests/functional/openlp_plugins/songs/test_openoffice.py index e122da806..45ef2acfd 100644 --- a/tests/functional/openlp_plugins/songs/test_openoffice.py +++ b/tests/functional/openlp_plugins/songs/test_openoffice.py @@ -22,20 +22,20 @@ """ This module contains tests for the OpenOffice/LibreOffice importer. """ -from unittest import TestCase, SkipTest +from unittest import TestCase, skipIf from unittest.mock import MagicMock, patch -from openlp.core.common import is_linux - -if not is_linux(): - raise SkipTest('Could not import OpenOfficeImport probably due to unavailability of uno') - from openlp.core.common.registry import Registry -from openlp.plugins.songs.lib.importers.openoffice import OpenOfficeImport from tests.helpers.testmixin import TestMixin +try: + from openlp.plugins.songs.lib.importers.openoffice import OpenOfficeImport +except ImportError: + OpenOfficeImport = None + +@skipIf(OpenOfficeImport is None, 'Could not import OpenOfficeImport probably due to unavailability of uno') class TestOpenOfficeImport(TestCase, TestMixin): """ Test the :class:`~openlp.plugins.songs.lib.importer.openoffice.OpenOfficeImport` class From ba392da66590265395a2632c02122df8e74f65c6 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 30 Nov 2017 17:31:48 -0700 Subject: [PATCH 4/6] Skip locale test on macOS until we can figure it out --- tests/functional/openlp_core/common/test_i18n.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/functional/openlp_core/common/test_i18n.py b/tests/functional/openlp_core/common/test_i18n.py index bffb819dc..4f4ca2aec 100644 --- a/tests/functional/openlp_core/common/test_i18n.py +++ b/tests/functional/openlp_core/common/test_i18n.py @@ -22,8 +22,10 @@ """ Package to test the openlp.core.lib.languages package. """ +from unittest import skipIf from unittest.mock import MagicMock, patch +from openlp.core.common import is_macosx from openlp.core.common.i18n import LANGUAGES, Language, UiStrings, get_language, get_locale_key, get_natural_key, \ translate @@ -110,6 +112,7 @@ def test_get_language_invalid_with_none(): assert language is None +@skipIf(is_macosx(), 'This test doesn\'t work on macOS currently') def test_get_locale_key(): """ Test the get_locale_key(string) function From e5d82de5dbd9dec461244de30bde170b14a2742d Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 30 Nov 2017 17:44:22 -0700 Subject: [PATCH 5/6] Add new macOS build to CI script --- scripts/jenkins_script.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/jenkins_script.py b/scripts/jenkins_script.py index a669de71e..f6d07236f 100755 --- a/scripts/jenkins_script.py +++ b/scripts/jenkins_script.py @@ -63,9 +63,10 @@ class OpenLPJobs(object): Branch_Coverage = 'Branch-04b-Test_Coverage' Branch_Pylint = 'Branch-04c-Code_Analysis2' Branch_AppVeyor = 'Branch-05-AppVeyor-Tests' + Branch_macOS = 'Branch-07-macOS-Tests' Jobs = [Branch_Pull, Branch_Functional, Branch_Interface, Branch_PEP, Branch_Coverage, Branch_Pylint, - Branch_AppVeyor] + Branch_AppVeyor, Branch_macOS] class Colour(object): From 287debf9cf6580859f7ec606a98e1b35e207e4e3 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 1 Dec 2017 00:26:51 -0700 Subject: [PATCH 6/6] Add a way to continue watching all jobs, even if one fails --- scripts/jenkins_script.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/jenkins_script.py b/scripts/jenkins_script.py index f6d07236f..c7ca693be 100755 --- a/scripts/jenkins_script.py +++ b/scripts/jenkins_script.py @@ -116,7 +116,7 @@ class JenkinsTrigger(object): self.fetch_jobs() self.server.build_job(OpenLPJobs.Branch_Pull, {'BRANCH_NAME': self.repo_name, 'cause': cause}) - def print_output(self): + def print_output(self, can_continue=False): """ Print the status information of the build triggered. """ @@ -127,13 +127,21 @@ class JenkinsTrigger(object): revno = raw_output.decode().strip() print('%s (revision %s)' % (get_repo_name(), revno)) + failed_builds = [] for job in OpenLPJobs.Jobs: if not self.__print_build_info(job): if self.current_build: - print('Stopping after failure, see {}console for more details'.format(self.current_build['url'])) - else: + failed_builds.append((self.current_build['fullDisplayName'], self.current_build['url'])) + if not can_continue: print('Stopping after failure') - break + break + print('') + if failed_builds: + print('Failed builds:') + for build_name, url in failed_builds: + print(' - {}: {}console'.format(build_name, url)) + else: + print('All builds passed') def open_browser(self): """ @@ -228,6 +236,7 @@ def main(): help='Disable coloured output (always disabled on Windows)') parser.add_argument('-u', '--username', required=True, help='Your Jenkins username') parser.add_argument('-p', '--password', required=True, help='Your Jenkins password or personal token') + parser.add_argument('-c', '--always-continue', action='store_true', default=False, help='Continue despite failure') args = parser.parse_args() if not get_repo_name(): @@ -239,7 +248,7 @@ def main(): if args.open_browser: jenkins_trigger.open_browser() if not args.disable_output: - jenkins_trigger.print_output() + jenkins_trigger.print_output(can_continue=args.always_continue) if __name__ == '__main__':