diff --git a/openlp/.version b/openlp/.version index a4b9b4eef..0b1153b27 100644 --- a/openlp/.version +++ b/openlp/.version @@ -1 +1 @@ -2.5.dev2856 \ No newline at end of file +2.5.dev2899 \ No newline at end of file diff --git a/openlp/plugins/presentations/lib/maclocontroller.py b/openlp/plugins/presentations/lib/maclocontroller.py index 1b0cfea8c..0968e53fa 100644 --- a/openlp/plugins/presentations/lib/maclocontroller.py +++ b/openlp/plugins/presentations/lib/maclocontroller.py @@ -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): diff --git a/tests/functional/openlp_plugins/presentations/test_libreofficeserver.py b/tests/functional/openlp_plugins/presentations/test_libreofficeserver.py index d747317d9..7131de698 100644 --- a/tests/functional/openlp_plugins/presentations/test_libreofficeserver.py +++ b/tests/functional/openlp_plugins/presentations/test_libreofficeserver.py @@ -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 diff --git a/tests/functional/openlp_plugins/presentations/test_maclocontroller.py b/tests/functional/openlp_plugins/presentations/test_maclocontroller.py index e53a0b576..8fea0f80e 100644 --- a/tests/functional/openlp_plugins/presentations/test_maclocontroller.py +++ b/tests/functional/openlp_plugins/presentations/test_maclocontroller.py @@ -24,9 +24,10 @@ Functional tests to test the Mac LibreOffice class and related methods. """ 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 openlp.plugins.presentations.presentationplugin import __default_settings__ 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): """