Test fixes

This commit is contained in:
Phill Ridout 2017-12-22 22:35:09 +00:00
parent 38c124224f
commit a866bc5499
2 changed files with 16 additions and 13 deletions

View File

@ -60,21 +60,24 @@ class SundayPlusImport(SongImport):
for file_path in self.import_source: for file_path in self.import_source:
if self.stop_import_flag: if self.stop_import_flag:
return return
with file_path.open('rb') as song_file: self.do_import_file(file_path)
self.do_import_file(song_file)
def do_import_file(self, 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() with file_path.open('rb') as song_file:
if not self.parse(file_path.read()): self.set_defaults()
self.log_error(file_path.name) if not self.parse(song_file.read()):
return self.log_error(file_path.name)
if self.title == '': return
self.title = self.title_from_file_path(file_path) if self.title == '':
if not self.finish(): self.title = self.title_from_file_path(file_path)
self.log_error(file_path.name) if not self.finish():
self.log_error(file_path.name)
def parse(self, data, cell=False): def parse(self, data, cell=False):
""" """

View File

@ -34,9 +34,9 @@ except ImportError:
from openlp.plugins.bibles.lib.db import BibleDB from openlp.plugins.bibles.lib.db import BibleDB
from tests.utils import load_external_result_data 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') @skipUnless(HAS_PYSWORD, 'pysword not installed')