From f76c9adc39634bb5596a5ebaca46b124436e2914 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 8 Nov 2016 13:52:08 +0200 Subject: [PATCH] Fix up some pep8 issues --- .../presentations/lib/libreofficeserver.py | 2 -- .../presentations/lib/maclocontroller.py | 5 +---- .../presentations/test_libreofficeserver.py | 18 ++++++++++-------- .../presentations/test_maclocontroller.py | 1 - 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/openlp/plugins/presentations/lib/libreofficeserver.py b/openlp/plugins/presentations/lib/libreofficeserver.py index d498fe985..4241d9bb4 100644 --- a/openlp/plugins/presentations/lib/libreofficeserver.py +++ b/openlp/plugins/presentations/lib/libreofficeserver.py @@ -184,7 +184,6 @@ class LibreOfficeServer(object): if getattr(self, '_process') and can_kill: self._process.kill() - def load_presentation(self, file_path, screen_number): """ Load a presentation @@ -404,4 +403,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/openlp/plugins/presentations/lib/maclocontroller.py b/openlp/plugins/presentations/lib/maclocontroller.py index d35faa567..487825677 100644 --- a/openlp/plugins/presentations/lib/maclocontroller.py +++ b/openlp/plugins/presentations/lib/maclocontroller.py @@ -120,9 +120,7 @@ class MacLODocument(PresentationDocument): def load_presentation(self): """ - Called when a presentation is added to the SlideController. It builds the environment, starts communcations with - the background LibreOffice task started earlier. If LibreOffice is not present is is started. Once the environment - is available the presentation is loaded and started. + Tell the LibreOfficeServer to start the presentation. """ log.debug('Load Presentation LibreOffice') self.client.setup_desktop() @@ -262,4 +260,3 @@ class MacLODocument(PresentationDocument): :param slide_no: The slide the notes are required for, starting at 1 """ return self.client.get_slide_notes(slide_no) - diff --git a/tests/functional/openlp_plugins/presentations/test_libreofficeserver.py b/tests/functional/openlp_plugins/presentations/test_libreofficeserver.py index b410b4547..d350ee9e1 100644 --- a/tests/functional/openlp_plugins/presentations/test_libreofficeserver.py +++ b/tests/functional/openlp_plugins/presentations/test_libreofficeserver.py @@ -109,14 +109,14 @@ def test_setup_desktop_exception(mocked_uno): # THEN: A desktop object was created mocked_uno.getComponentContext.assert_called_once_with() mocked_context.ServiceManager.createInstanceWithContext.assert_called_once_with( - 'com.sun.star.bridge.UnoUrlResolver', mocked_context) + 'com.sun.star.bridge.UnoUrlResolver', mocked_context) expected_calls = [ call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext'), call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext') ] assert mocked_resolver.resolve.call_args_list == expected_calls MockedServiceManager.createInstanceWithContext.assert_called_once_with( - 'com.sun.star.frame.Desktop', mocked_uno_instance) + 'com.sun.star.frame.Desktop', mocked_uno_instance) assert server._manager is MockedServiceManager assert server._desktop is None @@ -145,14 +145,14 @@ def test_setup_desktop(mocked_uno): # THEN: A desktop object was created mocked_uno.getComponentContext.assert_called_once_with() mocked_context.ServiceManager.createInstanceWithContext.assert_called_once_with( - 'com.sun.star.bridge.UnoUrlResolver', mocked_context) + 'com.sun.star.bridge.UnoUrlResolver', mocked_context) expected_calls = [ call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext'), call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext') ] assert mocked_resolver.resolve.call_args_list == expected_calls MockedServiceManager.createInstanceWithContext.assert_called_once_with( - 'com.sun.star.frame.Desktop', mocked_uno_instance) + 'com.sun.star.frame.Desktop', mocked_uno_instance) assert server._manager is MockedServiceManager assert server._desktop is mocked_desktop @@ -291,6 +291,9 @@ def test_shutdown_other_docs(): """ Test the shutdown method while other documents are open in LibreOffice """ + def close_docs(): + server._docs = [] + # GIVEN: An up an running LibreOfficeServer server = LibreOfficeServer() mocked_doc = MagicMock() @@ -301,8 +304,6 @@ def test_shutdown_other_docs(): server._docs = [mocked_doc] server._desktop = mocked_desktop server._process = MagicMock() - def close_docs(): - server._docs = [] mocked_doc.close_presentation.side_effect = close_docs mocked_desktop.getComponents.return_value = mocked_docs mocked_docs.hasElements.return_value = True @@ -333,6 +334,9 @@ def test_shutdown(): """ Test the shutdown method """ + def close_docs(): + server._docs = [] + # GIVEN: An up an running LibreOfficeServer server = LibreOfficeServer() mocked_doc = MagicMock() @@ -343,8 +347,6 @@ def test_shutdown(): server._docs = [mocked_doc] server._desktop = mocked_desktop server._process = MagicMock() - def close_docs(): - server._docs = [] mocked_doc.close_presentation.side_effect = close_docs mocked_desktop.getComponents.return_value = mocked_docs mocked_docs.hasElements.return_value = True diff --git a/tests/functional/openlp_plugins/presentations/test_maclocontroller.py b/tests/functional/openlp_plugins/presentations/test_maclocontroller.py index ae24658df..ac55d09b3 100644 --- a/tests/functional/openlp_plugins/presentations/test_maclocontroller.py +++ b/tests/functional/openlp_plugins/presentations/test_maclocontroller.py @@ -134,7 +134,6 @@ class TestMacLOController(TestCase, TestMixin): # THEN: The client's start_process() should have been called controller._client.start_process.assert_called_once_with() - @patch('openlp.plugins.presentations.lib.maclocontroller.MacLOController._start_server') def test_kill(self, mocked_start_server): """