Do not resolve paths, since it does not work as expected on windows.

This commit is contained in:
Tomas Groth 2019-11-29 17:00:12 +00:00 committed by Tim Bentley
parent f5ffc6d57e
commit 4f4de6249d
3 changed files with 7 additions and 8 deletions

View File

@ -15,7 +15,7 @@ environment:
install:
# Install dependencies from pypi
- "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF QDarkStyle python-vlc Pyro4 zeroconf"
- "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF==1.16.7 QDarkStyle python-vlc Pyro4 zeroconf"
build: off

View File

@ -68,7 +68,7 @@ class AppLocation(object):
path = get_frozen_path(FROZEN_APP_PATH, _get_os_dir_path(dir_type)) / 'i18n'
else:
path = _get_os_dir_path(dir_type)
return path.resolve()
return path
@staticmethod
def get_data_path():
@ -84,7 +84,7 @@ class AppLocation(object):
else:
path = AppLocation.get_directory(AppLocation.DataDir)
create_paths(path)
return path.resolve()
return path
@staticmethod
def get_files(section=None, extension=''):

View File

@ -30,7 +30,6 @@ from openlp.core.common.applocation import AppLocation
FILE_LIST = ['file1', 'file2', 'file3.txt', 'file4.txt', 'file5.mp3', 'file6.mp3']
BASE_DIR = (AppLocation.get_directory(AppLocation.AppDir) / '..').resolve()
@patch('openlp.core.common.applocation.Settings')
@ -54,7 +53,7 @@ def test_get_data_path(mocked_os, mocked_create_paths, mocked_get_directory, Moc
MockSettings.return_value.contains.assert_called_with('advanced/data path')
mocked_get_directory.assert_called_with(AppLocation.DataDir)
mocked_create_paths.assert_called_with(Path('tests', 'dir'))
assert data_path == Path(BASE_DIR, 'tests', 'dir'), 'Result should be "tests/dir"'
assert data_path == Path('tests', 'dir'), 'Result should be "tests/dir"'
@patch('openlp.core.common.applocation.Settings')
@ -72,7 +71,7 @@ def test_get_data_path_with_custom_location(MockSettings):
# THEN: the mocked Settings methods were called and the value returned was our set up value
MockSettings.return_value.contains.assert_called_with('advanced/data path')
MockSettings.return_value.value.assert_called_with('advanced/data path')
assert data_path == Path(BASE_DIR, 'custom', 'dir'), 'Result should be "custom/dir"'
assert data_path == Path('custom', 'dir'), 'Result should be "custom/dir"'
@patch('openlp.core.common.applocation.Path.glob')
@ -141,7 +140,7 @@ def test_get_directory_for_app_dir(mocked_get_frozen_path):
directory = AppLocation.get_directory(AppLocation.AppDir)
# THEN: check that the correct directory is returned
assert directory == Path(BASE_DIR, 'app', 'dir'), 'Directory should be "app/dir"'
assert directory == Path('app', 'dir'), 'Directory should be "app/dir"'
@patch('openlp.core.common.applocation.get_frozen_path')
@ -163,7 +162,7 @@ def test_get_directory_for_plugins_dir(mocked_sys, mocked_split, mocked_abspath,
directory = AppLocation.get_directory(AppLocation.PluginsDir)
# THEN: The correct directory should be returned
assert directory == Path(BASE_DIR, 'dir', 'plugins'), 'Directory should be "dir/plugins"'
assert directory == Path('dir', 'plugins'), 'Directory should be "dir/plugins"'
@patch('openlp.core.common.sys')