diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index ee627fc6c..c8efd42b7 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -125,7 +125,6 @@ class InfoLabel(QtGui.QLabel): alignment = QtCore.Qt.AlignLeft painter.drawText(self.rect(), alignment, elided) - def setText(self, text): """ Reimplemented to set the tool tip text. diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 257351758..7ecb56ea7 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -429,7 +429,7 @@ def get_uno_command(connection_type='pipe'): """ for command in ['libreoffice', 'soffice']: if which(command): - break + break else: raise FileNotFoundError('Command not found') diff --git a/tests/functional/openlp_core_ui/test_slidecontroller.py b/tests/functional/openlp_core_ui/test_slidecontroller.py index 9a6edd567..b0297aca0 100644 --- a/tests/functional/openlp_core_ui/test_slidecontroller.py +++ b/tests/functional/openlp_core_ui/test_slidecontroller.py @@ -560,6 +560,7 @@ class TestSlideController(TestCase): mocked_preview_widget.change_slide.assert_called_once_with(7) mocked_slide_selected.assert_called_once_with() + class TestInfoLabel(TestCase): def paint_event_text_fits_test(self): @@ -570,7 +571,7 @@ class TestInfoLabel(TestCase): metrics = QtGui.QFontMetrics(font) with patch('openlp.core.ui.slidecontroller.QtGui.QLabel'), \ - patch('openlp.core.ui.slidecontroller.QtGui.QPainter') as mocked_qpainter: + patch('openlp.core.ui.slidecontroller.QtGui.QPainter') as mocked_qpainter: # GIVEN: An instance of InfoLabel, with mocked text return, width and rect methods info_label = InfoLabel() @@ -598,7 +599,7 @@ class TestInfoLabel(TestCase): metrics = QtGui.QFontMetrics(font) with patch('openlp.core.ui.slidecontroller.QtGui.QLabel'), \ - patch('openlp.core.ui.slidecontroller.QtGui.QPainter') as mocked_qpainter: + patch('openlp.core.ui.slidecontroller.QtGui.QPainter') as mocked_qpainter: # GIVEN: An instance of InfoLabel, with mocked text return, width and rect methods info_label = InfoLabel() diff --git a/tests/functional/openlp_core_ui/test_themeform.py b/tests/functional/openlp_core_ui/test_themeform.py index 1a32edddb..11214e03a 100644 --- a/tests/functional/openlp_core_ui/test_themeform.py +++ b/tests/functional/openlp_core_ui/test_themeform.py @@ -48,13 +48,12 @@ class TestThemeManager(TestCase): # GIVEN: An instance of Theme Form and mocked QFileDialog which returns an empty string (similating a user # pressing cancel) with patch('openlp.core.ui.ThemeForm._setup'),\ - patch('openlp.core.ui.themeform.get_images_filter', - **{'return_value': 'Image Files (*.bmp; *.gif)(*.bmp *.gif)'}),\ - patch('openlp.core.ui.themeform.QtGui.QFileDialog.getOpenFileName', - **{'return_value': ''}) as mocked_get_open_file_name,\ - patch('openlp.core.ui.themeform.translate', **{'return_value': 'Translated String'}),\ - patch('openlp.core.ui.ThemeForm.set_background_page_values') as mocked_set_background_page_values: - + patch('openlp.core.ui.themeform.get_images_filter', + **{'return_value': 'Image Files (*.bmp; *.gif)(*.bmp *.gif)'}),\ + patch('openlp.core.ui.themeform.QtGui.QFileDialog.getOpenFileName', + **{'return_value': ''}) as mocked_get_open_file_name,\ + patch('openlp.core.ui.themeform.translate', **{'return_value': 'Translated String'}),\ + patch('openlp.core.ui.ThemeForm.set_background_page_values') as mocked_set_background_page_values: instance = ThemeForm(None) mocked_image_file_edit = MagicMock() mocked_image_file_edit.text.return_value = '/original_path/file.ext' @@ -66,8 +65,8 @@ class TestThemeManager(TestCase): # THEN: The QFileDialog getOpenFileName and set_background_page_values moethods should have been called # with known arguments mocked_get_open_file_name.assert_called_once_with(instance, 'Translated String', '/original_path/file.ext', - 'Image Files (*.bmp; *.gif)(*.bmp *.gif);;All Files (*.*)' - ) + 'Image Files (*.bmp; *.gif)(*.bmp *.gif);;' + 'All Files (*.*)') mocked_set_background_page_values.assert_called_once_with() def select_image_file_dialog_new_file_test(self): @@ -76,13 +75,12 @@ class TestThemeManager(TestCase): """ # GIVEN: An instance of Theme Form and mocked QFileDialog which returns a file path with patch('openlp.core.ui.ThemeForm._setup'),\ - patch('openlp.core.ui.themeform.get_images_filter', - **{'return_value': 'Image Files (*.bmp; *.gif)(*.bmp *.gif)'}),\ - patch('openlp.core.ui.themeform.QtGui.QFileDialog.getOpenFileName', - **{'return_value': '/new_path/file.ext'}) as mocked_get_open_file_name,\ - patch('openlp.core.ui.themeform.translate', **{'return_value': 'Translated String'}),\ - patch('openlp.core.ui.ThemeForm.set_background_page_values') as mocked_background_page_values: - + patch('openlp.core.ui.themeform.get_images_filter', + **{'return_value': 'Image Files (*.bmp; *.gif)(*.bmp *.gif)'}),\ + patch('openlp.core.ui.themeform.QtGui.QFileDialog.getOpenFileName', + **{'return_value': '/new_path/file.ext'}) as mocked_get_open_file_name,\ + patch('openlp.core.ui.themeform.translate', **{'return_value': 'Translated String'}),\ + patch('openlp.core.ui.ThemeForm.set_background_page_values') as mocked_background_page_values: instance = ThemeForm(None) mocked_image_file_edit = MagicMock() mocked_image_file_edit.text.return_value = '/original_path/file.ext' @@ -95,8 +93,8 @@ class TestThemeManager(TestCase): # THEN: The QFileDialog getOpenFileName and set_background_page_values moethods should have been called # with known arguments and theme.background_filename should be set mocked_get_open_file_name.assert_called_once_with(instance, 'Translated String', '/original_path/file.ext', - 'Image Files (*.bmp; *.gif)(*.bmp *.gif);;All Files (*.*)' - ) + 'Image Files (*.bmp; *.gif)(*.bmp *.gif);;' + 'All Files (*.*)') self.assertEqual(instance.theme.background_filename, '/new_path/file.ext', 'theme.background_filename should be set to the path that the file dialog returns') mocked_background_page_values.assert_called_once_with() diff --git a/tests/functional/openlp_core_utils/test_init.py b/tests/functional/openlp_core_utils/test_init.py index a64a9b25c..819dde6ef 100644 --- a/tests/functional/openlp_core_utils/test_init.py +++ b/tests/functional/openlp_core_utils/test_init.py @@ -83,7 +83,7 @@ class TestInitFunctions(TestMixin, TestCase): # THEN: The command 'libreoffice' should be called with the appropriate parameters self.assertEquals(result, 'libreoffice --nologo --norestore --minimized --nodefault --nofirststartwizard' - ' "--accept=pipe,name=openlp_pipe;urp;"') + ' "--accept=pipe,name=openlp_pipe;urp;"') def get_uno_command_only_soffice_command_exists_test(self): """ @@ -101,7 +101,7 @@ class TestInitFunctions(TestMixin, TestCase): # THEN: The command 'soffice' should be called with the appropriate parameters self.assertEquals(result, 'soffice --nologo --norestore --minimized --nodefault --nofirststartwizard' - ' "--accept=pipe,name=openlp_pipe;urp;"') + ' "--accept=pipe,name=openlp_pipe;urp;"') def get_uno_command_when_no_command_exists_test(self): """ diff --git a/tests/functional/openlp_plugins/custom/test_mediaitem.py b/tests/functional/openlp_plugins/custom/test_mediaitem.py index ef04dfb4e..67671695b 100644 --- a/tests/functional/openlp_plugins/custom/test_mediaitem.py +++ b/tests/functional/openlp_plugins/custom/test_mediaitem.py @@ -98,4 +98,4 @@ class TestMediaItem(TestCase, TestMixin): # THEN: the item should not be added to the database. self.assertEqual(self.media_item.create_from_service_item.call_count, 1, - 'The item should have been added to the database') \ No newline at end of file + 'The item should have been added to the database')