test fixes

This commit is contained in:
Philip Ridout 2017-08-02 07:09:38 +01:00
parent 17fb6ba835
commit e787896931
5 changed files with 11 additions and 10 deletions

View File

@ -87,7 +87,7 @@ class AppLocation(object):
def get_data_path():
"""
Return the path OpenLP stores all its data under.
:return: The data path to use.
:rtype: pathlib.Path
"""
@ -103,15 +103,15 @@ class AppLocation(object):
def get_files(section=None, extension=''):
"""
Get a list of files from the data files path.
:param section: Defaults to *None*. The section of code getting the files - used to load from a section's data
:param section: Defaults to *None*. The section of code getting the files - used to load from a section's data
subdirectory.
:type section: None | str
:param extension: Defaults to ''. The extension to search for. For example::
'.png'
:type extension: str
:return: List of files found.
:rtype: list[pathlib.Path]
"""
@ -141,10 +141,10 @@ class AppLocation(object):
def _get_os_dir_path(dir_type):
"""
Return a path based on which OS and environment we are running in.
:param dir_type: AppLocation Enum of the requested path type
:type dir_type: AppLocation Enum
:return: The requested path
:rtype: pathlib.Path
"""

View File

@ -58,4 +58,4 @@ def str_to_path(string):
raise TypeError('parameter \'string\' must be of type str')
if string == '':
return None
return Path(string)
return Path(string)

View File

@ -773,7 +773,7 @@ def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None, pre
return None
try:
page = get_web_page(reference_url, header, True)
except:
except Exception as e:
page = None
if not page:
send_error_message('download')

View File

@ -533,7 +533,8 @@ class SongMediaItem(MediaManagerItem):
'copy', 'For song cloning'))
# Copy audio files from the old to the new song
if len(old_song.media_files) > 0:
save_path = os.path.join(str(AppLocation.get_section_data_path(self.plugin.name)), 'audio', str(new_song.id))
save_path = os.path.join(
str(AppLocation.get_section_data_path(self.plugin.name)), 'audio', str(new_song.id))
check_directory_exists(save_path)
for media_file in old_song.media_files:
new_media_file_name = os.path.join(save_path, os.path.basename(media_file.file_name))

View File

@ -85,4 +85,4 @@ class TestPath(TestCase):
result = str_to_path('')
# THEN: `path_to_str` should return None
self.assertEqual(result, None)
self.assertEqual(result, None)