Fix up and skip some of the tests that don't run on macOS, and add a new parameter to the Jenkins script to continue despite failure.

Add this to your merge proposal:
--------------------------------------------------------------------------------
lp:~raoul-snyman/openlp/dont-test-uno-on-macos (revision 2797)
https://ci.openlp.io/job/Branch-01-Pull/2325/                          [SUCCESS]
https://ci.openlp.io/job/Branch-02-Functional-Tests/2226/              [SUCCESS]
https://ci.openlp.io/jo...

bzr-revno: 2792
This commit is contained in:
Raoul Snyman 2017-12-02 08:20:56 +00:00 committed by Tim Bentley
commit 873a8ada90
3 changed files with 26 additions and 11 deletions

View File

@ -63,9 +63,10 @@ class OpenLPJobs(object):
Branch_Coverage = 'Branch-04b-Test_Coverage' Branch_Coverage = 'Branch-04b-Test_Coverage'
Branch_Pylint = 'Branch-04c-Code_Analysis2' Branch_Pylint = 'Branch-04c-Code_Analysis2'
Branch_AppVeyor = 'Branch-05-AppVeyor-Tests' 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, Jobs = [Branch_Pull, Branch_Functional, Branch_Interface, Branch_PEP, Branch_Coverage, Branch_Pylint,
Branch_AppVeyor] Branch_AppVeyor, Branch_macOS]
class Colour(object): class Colour(object):
@ -115,7 +116,7 @@ class JenkinsTrigger(object):
self.fetch_jobs() self.fetch_jobs()
self.server.build_job(OpenLPJobs.Branch_Pull, {'BRANCH_NAME': self.repo_name, 'cause': cause}) 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. Print the status information of the build triggered.
""" """
@ -126,13 +127,21 @@ class JenkinsTrigger(object):
revno = raw_output.decode().strip() revno = raw_output.decode().strip()
print('%s (revision %s)' % (get_repo_name(), revno)) print('%s (revision %s)' % (get_repo_name(), revno))
failed_builds = []
for job in OpenLPJobs.Jobs: for job in OpenLPJobs.Jobs:
if not self.__print_build_info(job): if not self.__print_build_info(job):
if self.current_build: if self.current_build:
print('Stopping after failure, see {}console for more details'.format(self.current_build['url'])) failed_builds.append((self.current_build['fullDisplayName'], self.current_build['url']))
else: if not can_continue:
print('Stopping after failure') 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): def open_browser(self):
""" """
@ -227,6 +236,7 @@ def main():
help='Disable coloured output (always disabled on Windows)') help='Disable coloured output (always disabled on Windows)')
parser.add_argument('-u', '--username', required=True, help='Your Jenkins username') 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('-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() args = parser.parse_args()
if not get_repo_name(): if not get_repo_name():
@ -238,7 +248,7 @@ def main():
if args.open_browser: if args.open_browser:
jenkins_trigger.open_browser() jenkins_trigger.open_browser()
if not args.disable_output: if not args.disable_output:
jenkins_trigger.print_output() jenkins_trigger.print_output(can_continue=args.always_continue)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -22,8 +22,10 @@
""" """
Package to test the openlp.core.lib.languages package. Package to test the openlp.core.lib.languages package.
""" """
from unittest import skipIf
from unittest.mock import MagicMock, patch 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, \ from openlp.core.common.i18n import LANGUAGES, Language, UiStrings, get_language, get_locale_key, get_natural_key, \
translate translate
@ -110,6 +112,7 @@ def test_get_language_invalid_with_none():
assert language is None assert language is None
@skipIf(is_macosx(), 'This test doesn\'t work on macOS currently')
def test_get_locale_key(): def test_get_locale_key():
""" """
Test the get_locale_key(string) function Test the get_locale_key(string) function

View File

@ -22,18 +22,20 @@
""" """
This module contains tests for the OpenOffice/LibreOffice importer. 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 unittest.mock import MagicMock, patch
from openlp.core.common.registry import Registry from openlp.core.common.registry import Registry
try:
from openlp.plugins.songs.lib.importers.openoffice import OpenOfficeImport
except ImportError:
raise SkipTest('Could not import OpenOfficeImport probably due to unavailability of uno')
from tests.helpers.testmixin import TestMixin 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): class TestOpenOfficeImport(TestCase, TestMixin):
""" """
Test the :class:`~openlp.plugins.songs.lib.importer.openoffice.OpenOfficeImport` class Test the :class:`~openlp.plugins.songs.lib.importer.openoffice.OpenOfficeImport` class