From a9df7771f654fdcb80f191ecd84afa6444457612 Mon Sep 17 00:00:00 2001 From: Jonathan Springer Date: Sun, 10 Jan 2016 17:09:18 -0500 Subject: [PATCH 1/4] Skip OpenOffice test if uno isn't available --- tests/functional/openlp_plugins/songs/test_openoffice.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/functional/openlp_plugins/songs/test_openoffice.py b/tests/functional/openlp_plugins/songs/test_openoffice.py index 231193951..acb56939f 100644 --- a/tests/functional/openlp_plugins/songs/test_openoffice.py +++ b/tests/functional/openlp_plugins/songs/test_openoffice.py @@ -22,10 +22,13 @@ """ This module contains tests for the OpenOffice/LibreOffice importer. """ -from unittest import TestCase +from unittest import TestCase, SkipTest from openlp.core.common import Registry -from openlp.plugins.songs.lib.importers.openoffice import OpenOfficeImport +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.functional import MagicMock, patch from tests.helpers.testmixin import TestMixin From 263a7b2c62b2e0397178b4576be4aeeb08625c73 Mon Sep 17 00:00:00 2001 From: Jonathan Springer Date: Sun, 10 Jan 2016 17:10:05 -0500 Subject: [PATCH 2/4] Fix macosx_display_windows_flags_state test --- tests/functional/openlp_core_ui/test_maindisplay.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/functional/openlp_core_ui/test_maindisplay.py b/tests/functional/openlp_core_ui/test_maindisplay.py index 1f4649dbc..563eb578d 100644 --- a/tests/functional/openlp_core_ui/test_maindisplay.py +++ b/tests/functional/openlp_core_ui/test_maindisplay.py @@ -141,14 +141,13 @@ class TestMainDisplay(TestCase, TestMixin): mocked_songs_plugin.refresh_css.assert_called_with(main_display.frame) mocked_bibles_plugin.refresh_css.assert_called_with(main_display.frame) - @skipUnless(is_macosx(), 'Can only run test on Mac OS X due to pyobjc dependency.') - def macosx_display_window_flags_state_test(self, is_macosx): + @patch('openlp.core.ui.maindisplay.is_macosx') + def macosx_display_window_flags_state_test(self, mocked_is_macosx): """ Test that on Mac OS X we set the proper window flags """ - if not is_macosx(): - self.skipTest('Can only run test on Mac OS X due to pyobjc dependency.') # GIVEN: A new SlideController instance on Mac OS X. + mocked_is_macosx.return_value = True self.screens.set_current_display(0) display = MagicMock() From c07503f5dc0272fa3bd0b5431797ce204948db6e Mon Sep 17 00:00:00 2001 From: Jonathan Springer Date: Sun, 10 Jan 2016 17:10:50 -0500 Subject: [PATCH 3/4] Fix import --- tests/functional/openlp_core_lib/test_projector_pjlink1.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_projector_pjlink1.py b/tests/functional/openlp_core_lib/test_projector_pjlink1.py index 4079ab9f0..92ce02acd 100644 --- a/tests/functional/openlp_core_lib/test_projector_pjlink1.py +++ b/tests/functional/openlp_core_lib/test_projector_pjlink1.py @@ -25,10 +25,9 @@ Package to test the openlp.core.lib.projector.pjlink1 package. from unittest import TestCase -from mock import MagicMock, patch - from openlp.core.lib.projector.pjlink1 import PJLink1 +from tests.functional import patch from tests.resources.projector.data import TEST_PIN, TEST_SALT, TEST_CONNECT_AUTHENTICATE pjlink_test = PJLink1(name='test', ip='127.0.0.1', pin=TEST_PIN, no_poll=True) From fc2efb73435ca12f1cd03031fbcfc777ab263ab0 Mon Sep 17 00:00:00 2001 From: Jonathan Springer Date: Sun, 10 Jan 2016 22:27:28 -0500 Subject: [PATCH 4/4] Fix Mac OS X display flags test --- tests/functional/openlp_core_ui/test_maindisplay.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/functional/openlp_core_ui/test_maindisplay.py b/tests/functional/openlp_core_ui/test_maindisplay.py index 563eb578d..9c80740f2 100644 --- a/tests/functional/openlp_core_ui/test_maindisplay.py +++ b/tests/functional/openlp_core_ui/test_maindisplay.py @@ -141,13 +141,12 @@ class TestMainDisplay(TestCase, TestMixin): mocked_songs_plugin.refresh_css.assert_called_with(main_display.frame) mocked_bibles_plugin.refresh_css.assert_called_with(main_display.frame) - @patch('openlp.core.ui.maindisplay.is_macosx') - def macosx_display_window_flags_state_test(self, mocked_is_macosx): + @skipUnless(is_macosx(), 'Can only run test on Mac OS X due to pyobjc dependency.') + def macosx_display_window_flags_state_test(self): """ Test that on Mac OS X we set the proper window flags """ # GIVEN: A new SlideController instance on Mac OS X. - mocked_is_macosx.return_value = True self.screens.set_current_display(0) display = MagicMock()