Port to non-MacOS platforms (#1026)

* Port to non-MacOS platforms

* Keep NFD normalization on macOS

* Update locale_util.py

Fix lint error from ruff (runs in CI)

* Update query.py

click.Option first arg needs to be a list (different than click.option)

* Dynamically normalize Unicode paths in test

* Fix missing import

---------

Co-authored-by: Rhet Turnbull <rturnbull@gmail.com>
This commit is contained in:
dvdkon
2023-05-07 15:55:56 +02:00
committed by GitHub
parent 0c85298c03
commit ca3da647f2
51 changed files with 726 additions and 360 deletions

View File

@@ -8,6 +8,7 @@ from osxphotos.uti import (
get_preferred_uti_extension,
get_uti_for_extension,
)
from osxphotos.utils import is_macos
EXT_DICT = {"heic": "public.heic", "jpg": "public.jpeg", ".jpg": "public.jpeg"}
UTI_DICT = {"public.heic": "heic", "public.jpeg": "jpeg"}
@@ -43,12 +44,14 @@ def test_get_uti_for_extension_no_objc():
osxphotos.uti.OS_VER = OLD_VER
@pytest.mark.skipif(not is_macos, reason="Only works on macOS")
def test_get_uti_from_mdls():
"""get _get_uti_from_mdls"""
for ext in EXT_DICT:
assert _get_uti_from_mdls(ext) == EXT_DICT[ext]
@pytest.mark.skipif(not is_macos, reason="Only works on macOS")
def test_get_uti_not_in_dict():
"""get UTI when objc is not available and it's not in the EXT_UTI_DICT"""
# monkey patch the EXT_UTI_DICT