def test__app_local_data(self): if qt_version < (5, 4, 1): raise SkipTest paths = get_standard_paths(Location.app_local_data) path_strs = [] for path in paths: assert_is_instance(path, pathlib.Path) path_strs.append(path.as_posix()) qt_path_strs = QStandardPaths.standardLocations( QStandardPaths.AppLocalDataLocation, ) if platform.system() == 'Darwin': # Exclude bundle path on OS X. See comments in # `get_standard_paths` implementation for more information. if qt_path_strs[-1].rstrip('/').endswith('Python.app'): qt_path_strs = qt_path_strs[:-1] elif platform.system() == 'Windows': # Exclude paths relative to executable. See comments in # `get_standard_paths` implementation for more information. python_loc = (pathlib.Path(sys.executable) / '..').resolve() qt_path_strs = [ ps for ps in qt_path_strs if ps not in ( python_loc.as_posix(), (python_loc / 'data').as_posix(), ) ] eq_(path_strs, qt_path_strs)
def _test_against_qt(self, location, qt_location): paths = get_standard_paths(location) path_strs = [] for path in paths: assert_is_instance(path, pathlib.Path) path_strs.append(path.as_posix()) eq_(path_strs, QStandardPaths.standardLocations(qt_location))
def test__generic_config(self): paths = get_standard_paths(Location.generic_config) path_strs = [] for path in paths: assert_is_instance(path, pathlib.Path) path_strs.append(path.as_posix()) qt_path_strs = QStandardPaths.standardLocations( QStandardPaths.GenericConfigLocation, ) if platform.system() == 'Windows': # Exclude paths relative to executable. See comments in # `get_standard_paths` implementation for more information. python_loc = (pathlib.Path(sys.executable) / '..').resolve() qt_path_strs = [ ps for ps in qt_path_strs if ps not in ( python_loc.as_posix(), (python_loc / 'data').as_posix(), ) ] eq_(path_strs, qt_path_strs)
def test_unix__log(self): eq_(get_standard_paths(Location.log), [get_writable_path(Location.cache) / 'log'])
def test_windows__log(self): eq_(get_standard_paths(Location.log), [get_writable_path(Location.app_local_data) / 'log'])
def test_osx__log(self): exp = pathlib.Path(os.path.expanduser('~/Library/Logs/uranusjr/Yksom')) eq_(get_standard_paths(Location.log), [exp])