From 1d736a58f5ccff7534d0af3078c2266946a184fa Mon Sep 17 00:00:00 2001 From: Phill Date: Sat, 4 May 2019 13:05:53 +0100 Subject: [PATCH] Fix up tests --- openlp/core/ui/mainwindow.py | 2 ++ tests/functional/openlp_core/common/test_common.py | 4 ++-- tests/functional/openlp_core/test_app.py | 4 ++-- tests/functional/openlp_core/ui/test_mainwindow.py | 2 +- tests/functional/openlp_plugins/bibles/test_csvimport.py | 3 +-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 703bdc943..7c26ea9a4 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1356,6 +1356,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert def open_cmd_line_files(self, args): """ Open files passed in through command line arguments + + :param list[str] args: List of remaining positionall arguments """ for arg in args: file_name = os.path.expanduser(arg) diff --git a/tests/functional/openlp_core/common/test_common.py b/tests/functional/openlp_core/common/test_common.py index 349ad6326..715e66ff6 100644 --- a/tests/functional/openlp_core/common/test_common.py +++ b/tests/functional/openlp_core/common/test_common.py @@ -88,7 +88,7 @@ class TestCommonFunctions(TestCase): extension_loader('glob') # THEN: The `ImportError` should be caught and logged - assert mocked_logger.warning.called + assert mocked_logger.exception.called def test_extension_loader_os_error(self): """ @@ -106,7 +106,7 @@ class TestCommonFunctions(TestCase): extension_loader('glob') # THEN: The `OSError` should be caught and logged - assert mocked_logger.warning.called + assert mocked_logger.exception.called def test_de_hump_conversion(self): """ diff --git a/tests/functional/openlp_core/test_app.py b/tests/functional/openlp_core/test_app.py index 744e98a47..37d7e1647 100644 --- a/tests/functional/openlp_core/test_app.py +++ b/tests/functional/openlp_core/test_app.py @@ -138,7 +138,7 @@ def test_parse_options_file(): assert args.loglevel == 'warning', 'The log level should be set to warning' assert args.no_error_form is False, 'The no_error_form should be set to False' assert args.portable is False, 'The portable flag should be set to false' - assert args.rargs == 'dummy_temp', 'The service file should not be blank' + assert args.rargs == ['dummy_temp'], 'The service file should not be blank' def test_parse_options_file_and_debug(): @@ -155,7 +155,7 @@ def test_parse_options_file_and_debug(): assert args.loglevel == ' debug', 'The log level should be set to debug' assert args.no_error_form is False, 'The no_error_form should be set to False' assert args.portable is False, 'The portable flag should be set to false' - assert args.rargs == 'dummy_temp', 'The service file should not be blank' + assert args.rargs == ['dummy_temp'], 'The service file should not be blank' @skip('Figure out why this is causing a segfault') diff --git a/tests/functional/openlp_core/ui/test_mainwindow.py b/tests/functional/openlp_core/ui/test_mainwindow.py index 1d1929286..817e2272e 100644 --- a/tests/functional/openlp_core/ui/test_mainwindow.py +++ b/tests/functional/openlp_core/ui/test_mainwindow.py @@ -96,7 +96,7 @@ class TestMainWindow(TestCase, TestMixin): # WHEN the argument is processed with patch.object(self.main_window.service_manager, 'load_file') as mocked_load_file: - self.main_window.open_cmd_line_files(service) + self.main_window.open_cmd_line_files([service]) # THEN the service from the arguments is loaded mocked_load_file.assert_called_with(Path(service)) diff --git a/tests/functional/openlp_plugins/bibles/test_csvimport.py b/tests/functional/openlp_plugins/bibles/test_csvimport.py index ca3b933ba..0110db597 100644 --- a/tests/functional/openlp_plugins/bibles/test_csvimport.py +++ b/tests/functional/openlp_plugins/bibles/test_csvimport.py @@ -136,8 +136,7 @@ class TestCSVImport(TestCase): mocked_enter_file = MagicMock() mocked_csv_file.open.return_value.__enter__.return_value = mocked_enter_file - with patch('openlp.plugins.bibles.lib.importers.csvbible.get_file_encoding', - return_value={'encoding': 'utf-8', 'confidence': 0.99}), \ + with patch('openlp.plugins.bibles.lib.importers.csvbible.get_file_encoding', return_value='utf-8'), \ patch('openlp.plugins.bibles.lib.importers.csvbible.csv.reader', return_value=iter(test_data)) as mocked_reader: