forked from openlp/openlp
Skip the Mac LO tests on non-Mac platforms; Make detection work for a missing Pyro4 as well
This commit is contained in:
parent
4f9a1b4e0b
commit
25a7c6f5b3
@ -1 +1 @@
|
||||
2.5.dev2856
|
||||
2.5.dev2899
|
@ -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):
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user