Fix up tests

This commit is contained in:
Phill 2019-05-04 13:05:53 +01:00
parent 7aa7e5c635
commit 1d736a58f5
5 changed files with 8 additions and 7 deletions

View File

@ -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)

View File

@ -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):
"""

View File

@ -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')

View File

@ -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))

View File

@ -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: