diff --git a/openlp/plugins/songs/lib/importers/sundayplus.py b/openlp/plugins/songs/lib/importers/sundayplus.py index fe8e7b042..a6bacf1b2 100644 --- a/openlp/plugins/songs/lib/importers/sundayplus.py +++ b/openlp/plugins/songs/lib/importers/sundayplus.py @@ -60,21 +60,24 @@ class SundayPlusImport(SongImport): for file_path in self.import_source: if self.stop_import_flag: return - with file_path.open('rb') as song_file: - self.do_import_file(song_file) + self.do_import_file(file_path) def do_import_file(self, file_path): """ - Process the Sunday Plus file object. + Process the Sunday Plus song file + + :param openlp.core.common.path.Path file_path: The song file to import + :rtype: None """ - self.set_defaults() - if not self.parse(file_path.read()): - self.log_error(file_path.name) - return - if self.title == '': - self.title = self.title_from_file_path(file_path) - if not self.finish(): - self.log_error(file_path.name) + with file_path.open('rb') as song_file: + self.set_defaults() + if not self.parse(song_file.read()): + self.log_error(file_path.name) + return + if self.title == '': + self.title = self.title_from_file_path(file_path) + if not self.finish(): + self.log_error(file_path.name) def parse(self, data, cell=False): """ diff --git a/tests/functional/openlp_plugins/bibles/test_swordimport.py b/tests/functional/openlp_plugins/bibles/test_swordimport.py index 4e6f3a80a..54c9e5c42 100644 --- a/tests/functional/openlp_plugins/bibles/test_swordimport.py +++ b/tests/functional/openlp_plugins/bibles/test_swordimport.py @@ -34,9 +34,9 @@ except ImportError: from openlp.plugins.bibles.lib.db import BibleDB from tests.utils import load_external_result_data -from tests.utils.constants import TEST_RESOURCES_PATH +from tests.utils.constants import RESOURCE_PATH -TEST_PATH = TEST_RESOURCES_PATH / 'bibles' +TEST_PATH = RESOURCE_PATH / 'bibles' @skipUnless(HAS_PYSWORD, 'pysword not installed')