Merge lp:~raoul-snyman/openlp/pyro4-maclo into lp:openlp

Proposed by Raoul Snyman
Status: Merged
Merged at revision: 2902
Proposed branch: lp:~raoul-snyman/openlp/pyro4-maclo
Merge into: lp:openlp
Diff against target: 108 lines (+33/-9)
4 files modified
openlp/.version (+1/-1)
openlp/plugins/presentations/lib/maclocontroller.py (+13/-7)
tests/functional/openlp_plugins/presentations/test_libreofficeserver.py (+10/-0)
tests/functional/openlp_plugins/presentations/test_maclocontroller.py (+9/-1)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/pyro4-maclo
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+372748@code.launchpad.net

Commit message

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

Description of the change

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

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

JavaScript tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linux tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

macOS tests passed!

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Linting passed!

Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/.version'
2--- openlp/.version 2019-01-27 14:42:23 +0000
3+++ openlp/.version 2019-09-13 06:52:20 +0000
4@@ -1,1 +1,1 @@
5-2.5.dev2856
6\ No newline at end of file
7+2.5.dev2899
8\ No newline at end of file
9
10=== modified file 'openlp/plugins/presentations/lib/maclocontroller.py'
11--- openlp/plugins/presentations/lib/maclocontroller.py 2019-08-30 11:28:10 +0000
12+++ openlp/plugins/presentations/lib/maclocontroller.py 2019-09-13 06:52:20 +0000
13@@ -23,29 +23,35 @@
14 import logging
15 from subprocess import Popen
16
17-from Pyro4 import Proxy
18-
19 from openlp.core.common import delete_file, is_macosx
20 from openlp.core.common.applocation import AppLocation
21 from openlp.core.common.mixins import LogMixin
22 from openlp.core.common.path import Path
23 from openlp.core.common.registry import Registry
24 from openlp.core.display.screens import ScreenList
25-from openlp.plugins.presentations.lib.serializers import register_classes
26 from openlp.plugins.presentations.lib.presentationcontroller import PresentationController, PresentationDocument
27
28
29 LIBREOFFICE_PATH = Path('/Applications/LibreOffice.app')
30 LIBREOFFICE_PYTHON = LIBREOFFICE_PATH / 'Contents' / 'Resources' / 'python'
31
32-if is_macosx() and LIBREOFFICE_PATH.exists():
33- macuno_available = True
34-else:
35+try:
36+ from Pyro4 import Proxy
37+ if is_macosx() and LIBREOFFICE_PATH.exists():
38+ macuno_available = True
39+ else:
40+ macuno_available = False
41+except ImportError:
42 macuno_available = False
43
44
45+if macuno_available:
46+ # If this controller is good to go, register the serializer classes with Pyro4
47+ from openlp.plugins.presentations.lib.serializers import register_classes
48+ register_classes()
49+
50+
51 log = logging.getLogger(__name__)
52-register_classes()
53
54
55 class MacLOController(PresentationController, LogMixin):
56
57=== modified file 'tests/functional/openlp_plugins/presentations/test_libreofficeserver.py'
58--- tests/functional/openlp_plugins/presentations/test_libreofficeserver.py 2019-06-05 04:57:26 +0000
59+++ tests/functional/openlp_plugins/presentations/test_libreofficeserver.py 2019-09-13 06:52:20 +0000
60@@ -22,8 +22,18 @@
61 """
62 Functional tests to test the LibreOffice Pyro server
63 """
64+from unittest import SkipTest
65 from unittest.mock import MagicMock, patch, call
66
67+from openlp.core.common import is_macosx
68+
69+try:
70+ import Pyro4 # noqa: F401
71+except ImportError:
72+ raise SkipTest('Pyro4 is not installed, skipping testing the LibreOffice server')
73+if not is_macosx():
74+ raise SkipTest('Not on macOS, skipping testing the LibreOffice server')
75+
76 from openlp.plugins.presentations.lib.libreofficeserver import LibreOfficeServer, TextType, main
77
78
79
80=== modified file 'tests/functional/openlp_plugins/presentations/test_maclocontroller.py'
81--- tests/functional/openlp_plugins/presentations/test_maclocontroller.py 2019-06-05 04:57:26 +0000
82+++ tests/functional/openlp_plugins/presentations/test_maclocontroller.py 2019-09-13 06:52:20 +0000
83@@ -24,9 +24,10 @@
84 """
85 import shutil
86 from tempfile import mkdtemp
87-from unittest import TestCase
88+from unittest import TestCase, SkipTest
89 from unittest.mock import MagicMock, patch, call
90
91+from openlp.core.common import is_macosx
92 from openlp.core.common.settings import Settings
93 from openlp.core.common.path import Path
94 from openlp.plugins.presentations.lib.maclocontroller import MacLOController, MacLODocument
95@@ -35,6 +36,13 @@
96 from tests.helpers.testmixin import TestMixin
97 from tests.utils.constants import TEST_RESOURCES_PATH
98
99+try:
100+ import Pyro4 # noqa: F401
101+except ImportError:
102+ raise SkipTest('Pyro4 is not installed, skipping testing the Mac LibreOffice controller')
103+if not is_macosx():
104+ raise SkipTest('Not on macOS, skipping testing the Mac LibreOffice controller')
105+
106
107 class TestMacLOController(TestCase, TestMixin):
108 """