Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/pyro4-maclo into 
lp:openlp.

Commit message:
Skip the Mac LO tests on non-Mac platforms; Make detection work for a missing 
Pyro4 as well

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/pyro4-maclo/+merge/372748

Skip the Mac LO tests on non-Mac platforms; Make detection work for a missing 
Pyro4 as well
-- 
Your team OpenLP Core is requested to review the proposed merge of 
lp:~raoul-snyman/openlp/pyro4-maclo into lp:openlp.
=== modified file 'openlp/.version'
--- openlp/.version	2019-01-27 14:42:23 +0000
+++ openlp/.version	2019-09-13 06:52:20 +0000
@@ -1,1 +1,1 @@
-2.5.dev2856
\ No newline at end of file
+2.5.dev2899
\ No newline at end of file

=== modified file 'openlp/plugins/presentations/lib/maclocontroller.py'
--- openlp/plugins/presentations/lib/maclocontroller.py	2019-08-30 11:28:10 +0000
+++ openlp/plugins/presentations/lib/maclocontroller.py	2019-09-13 06:52:20 +0000
@@ -23,29 +23,35 @@
 import logging
 from subprocess import Popen
 
-from Pyro4 import Proxy
-
 from openlp.core.common import delete_file, is_macosx
 from openlp.core.common.applocation import AppLocation
 from openlp.core.common.mixins import LogMixin
 from openlp.core.common.path import Path
 from openlp.core.common.registry import Registry
 from openlp.core.display.screens import ScreenList
-from openlp.plugins.presentations.lib.serializers import register_classes
 from openlp.plugins.presentations.lib.presentationcontroller import PresentationController, PresentationDocument
 
 
 LIBREOFFICE_PATH = Path('/Applications/LibreOffice.app')
 LIBREOFFICE_PYTHON = LIBREOFFICE_PATH / 'Contents' / 'Resources' / 'python'
 
-if is_macosx() and LIBREOFFICE_PATH.exists():
-    macuno_available = True
-else:
+try:
+    from Pyro4 import Proxy
+    if is_macosx() and LIBREOFFICE_PATH.exists():
+        macuno_available = True
+    else:
+        macuno_available = False
+except ImportError:
     macuno_available = False
 
 
+if macuno_available:
+    # If this controller is good to go, register the serializer classes with Pyro4
+    from openlp.plugins.presentations.lib.serializers import register_classes
+    register_classes()
+
+
 log = logging.getLogger(__name__)
-register_classes()
 
 
 class MacLOController(PresentationController, LogMixin):

=== modified file 'tests/functional/openlp_plugins/presentations/test_libreofficeserver.py'
--- tests/functional/openlp_plugins/presentations/test_libreofficeserver.py	2019-06-05 04:57:26 +0000
+++ tests/functional/openlp_plugins/presentations/test_libreofficeserver.py	2019-09-13 06:52:20 +0000
@@ -22,8 +22,18 @@
 """
 Functional tests to test the LibreOffice Pyro server
 """
+from unittest import SkipTest
 from unittest.mock import MagicMock, patch, call
 
+from openlp.core.common import is_macosx
+
+try:
+    import Pyro4    # noqa: F401
+except ImportError:
+    raise SkipTest('Pyro4 is not installed, skipping testing the LibreOffice server')
+if not is_macosx():
+    raise SkipTest('Not on macOS, skipping testing the LibreOffice server')
+
 from openlp.plugins.presentations.lib.libreofficeserver import LibreOfficeServer, TextType, main
 
 

=== modified file 'tests/functional/openlp_plugins/presentations/test_maclocontroller.py'
--- tests/functional/openlp_plugins/presentations/test_maclocontroller.py	2019-06-05 04:57:26 +0000
+++ tests/functional/openlp_plugins/presentations/test_maclocontroller.py	2019-09-13 06:52:20 +0000
@@ -24,9 +24,10 @@
 """
 import shutil
 from tempfile import mkdtemp
-from unittest import TestCase
+from unittest import TestCase, SkipTest
 from unittest.mock import MagicMock, patch, call
 
+from openlp.core.common import is_macosx
 from openlp.core.common.settings import Settings
 from openlp.core.common.path import Path
 from openlp.plugins.presentations.lib.maclocontroller import MacLOController, MacLODocument
@@ -35,6 +36,13 @@
 from tests.helpers.testmixin import TestMixin
 from tests.utils.constants import TEST_RESOURCES_PATH
 
+try:
+    import Pyro4    # noqa: F401
+except ImportError:
+    raise SkipTest('Pyro4 is not installed, skipping testing the Mac LibreOffice controller')
+if not is_macosx():
+    raise SkipTest('Not on macOS, skipping testing the Mac LibreOffice controller')
+
 
 class TestMacLOController(TestCase, TestMixin):
     """

_______________________________________________
Mailing list: https://launchpad.net/~openlp-core
Post to     : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp

Reply via email to