diff --git a/tests/functional/openlp_core/test_threading.py b/tests/functional/openlp_core/test_threading.py index 6926b1730..e493725d0 100644 --- a/tests/functional/openlp_core/test_threading.py +++ b/tests/functional/openlp_core/test_threading.py @@ -133,15 +133,11 @@ def test_get_thread_worker_mising(MockRegistry): # GIVEN: A mocked thread worker MockRegistry.return_value.get.return_value.worker_threads = {} - try: - # WHEN: get_thread_worker() is called - get_thread_worker('test_thread') - assert False, 'A KeyError should have been raised' - except KeyError: - # THEN: The mocked worker is returned - pass - except Exception: - assert False, 'A KeyError should have been raised' + # WHEN: get_thread_worker() is called + result = get_thread_worker('test_thread') + + # THEN: None should have been returned + assert result is None @patch('openlp.core.threading.Registry') diff --git a/tests/functional/openlp_plugins/songs/test_openlpimporter.py b/tests/functional/openlp_plugins/songs/test_openlpimporter.py index e76c08d3b..c67e18bbd 100644 --- a/tests/functional/openlp_plugins/songs/test_openlpimporter.py +++ b/tests/functional/openlp_plugins/songs/test_openlpimporter.py @@ -22,6 +22,7 @@ """ This module contains tests for the OpenLP song importer. """ +from pathlib import Path from unittest import TestCase from unittest.mock import MagicMock, patch @@ -66,10 +67,9 @@ class TestOpenLPImport(TestCase): importer.stop_import_flag = True # WHEN: Import source is not a list - for source in ['not a list', 0]: - importer.import_source = source + importer.import_source = Path() - # THEN: do_import should return none and the progress bar maximum should not be set. - assert importer.do_import() is None, 'do_import should return None when import_source is not a list' - assert mocked_import_wizard.progress_bar.setMaximum.called is False, \ - 'setMaximum on import_wizard.progress_bar should not have been called' + # THEN: do_import should return none and the progress bar maximum should not be set. + assert importer.do_import() is None, 'do_import should return None when import_source is not a list' + assert mocked_import_wizard.progress_bar.setMaximum.called is False, \ + 'setMaximum on import_wizard.progress_bar should not have been called'