From 59c31ff88d099b251cf1b571279d7a28a0aac138 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Tue, 14 Sep 2021 17:24:02 -0700 Subject: [PATCH] Fix for #515, updated tests --- README.md | 4 +- docs/.buildinfo | 2 +- docs/_modules/index.html | 2 +- .../photoinfo/_photoinfo_export.html | 27 ++- docs/_static/documentation_options.js | 2 +- docs/cli.html | 2 +- docs/genindex.html | 2 +- docs/index.html | 2 +- docs/modules.html | 2 +- docs/reference.html | 2 +- docs/search.html | 2 +- osxphotos/_version.py | 2 +- osxphotos/photoinfo/_photoinfo_export.py | 9 +- tests/test_catalina_10_15_7.py | 7 - tests/test_cli.py | 157 ++++++++++++++---- 15 files changed, 166 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index 781a2b3b..24409a2b 100644 --- a/README.md +++ b/README.md @@ -1702,7 +1702,7 @@ Substitution Description {lf} A line feed: '\n', alias for {newline} {cr} A carriage return: '\r' {crlf} a carriage return + line feed: '\r\n' -{osxphotos_version} The osxphotos version, e.g. '0.42.80' +{osxphotos_version} The osxphotos version, e.g. '0.42.82' {osxphotos_cmd_line} The full command line used to run osxphotos The following substitutions may result in multiple values. Thus if specified for @@ -3561,7 +3561,7 @@ The following template field substitutions are availabe for use the templating s |{lf}|A line feed: '\n', alias for {newline}| |{cr}|A carriage return: '\r'| |{crlf}|a carriage return + line feed: '\r\n'| -|{osxphotos_version}|The osxphotos version, e.g. '0.42.80'| +|{osxphotos_version}|The osxphotos version, e.g. '0.42.82'| |{osxphotos_cmd_line}|The full command line used to run osxphotos| |{album}|Album(s) photo is contained in| |{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder| diff --git a/docs/.buildinfo b/docs/.buildinfo index 72afd0bc..2bc5560d 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: dd9bfb6ffa88332ee840ad3af2dd7f37 +config: 7fc4fe26df020008d210765b32b7a1a9 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_modules/index.html b/docs/_modules/index.html index 99fbb7f0..a791e505 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -5,7 +5,7 @@ - Overview: module code — osxphotos 0.42.80 documentation + Overview: module code — osxphotos 0.42.82 documentation diff --git a/docs/_modules/osxphotos/photoinfo/_photoinfo_export.html b/docs/_modules/osxphotos/photoinfo/_photoinfo_export.html index 7cf1a783..62b1f0f5 100644 --- a/docs/_modules/osxphotos/photoinfo/_photoinfo_export.html +++ b/docs/_modules/osxphotos/photoinfo/_photoinfo_export.html @@ -5,7 +5,7 @@ - osxphotos.photoinfo._photoinfo_export — osxphotos 0.42.80 documentation + osxphotos.photoinfo._photoinfo_export — osxphotos 0.42.82 documentation @@ -89,7 +89,7 @@ ) from ..phototemplate import RenderOptions from ..uti import get_preferred_uti_extension -from ..utils import findfiles, lineno, noop +from ..utils import findfiles, lineno, noop, normalize_fs_path # retry if use_photos_export fails the first time (which sometimes it does) MAX_PHOTOSCRIPT_RETRIES = 3 @@ -719,9 +719,12 @@ count = 0 if not update and increment and not overwrite: dest_files = findfiles(f"{dest_original.stem}*", str(dest_original.parent)) - dest_files = [pathlib.Path(f).stem.lower() for f in dest_files] + # paths need to be normalized for unicode as filesystem returns unicode in NFD form + dest_files = [ + normalize_fs_path(pathlib.Path(f).stem.lower()) for f in dest_files + ] dest_new = dest_original.stem - while dest_new.lower() in dest_files: + while normalize_fs_path(dest_new.lower()) in dest_files: count += 1 dest_new = f"{dest_original.stem} ({count})" dest_original = dest_original.parent / f"{dest_new}{dest_original.suffix}" @@ -741,12 +744,15 @@ if export_edited: if not update and increment and not overwrite: dest_files = findfiles(f"{dest_edited.stem}*", str(dest_edited.parent)) - dest_files = [pathlib.Path(f).stem.lower() for f in dest_files] + # paths need to be normalized for unicode as filesystem returns unicode in NFD form + dest_files = [ + normalize_fs_path(pathlib.Path(f).stem.lower()) for f in dest_files + ] dest_new = dest_edited.stem if count: # incremented above when checking original destination dest_new = f"{dest_new} ({count})" - while dest_new.lower() in dest_files: + while normalize_fs_path(dest_new.lower()) in dest_files: count += 1 dest_new = f"{dest.stem} ({count})" dest_edited = dest_edited.parent / f"{dest_new}{dest_edited.suffix}" @@ -864,13 +870,18 @@ count = 1 glob_str = str(dest.parent / f"{dest.stem}*") dest_files = glob.glob(glob_str) - dest_files = [pathlib.Path(f).stem for f in dest_files] + dest_files = [normalize_fs_path(pathlib.Path(f).stem) for f in dest_files] dest_new = dest.stem - while dest_new in dest_files: + while normalize_fs_path(dest_new) in dest_files: dest_new = f"{dest.stem} ({count})" count += 1 dest = dest.parent / f"{dest_new}{dest.suffix}" + if export_original: + dest_original = dest + else: + dest_edited = dest + # export the dest file results = self._export_photo( src, diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 23416e8b..a8741bee 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '0.42.80', + VERSION: '0.42.82', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/cli.html b/docs/cli.html index 6bb7231a..cb16a991 100644 --- a/docs/cli.html +++ b/docs/cli.html @@ -5,7 +5,7 @@ - osxphotos command line interface (CLI) — osxphotos 0.42.80 documentation + osxphotos command line interface (CLI) — osxphotos 0.42.82 documentation diff --git a/docs/genindex.html b/docs/genindex.html index 4996914e..2a8d52fa 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -5,7 +5,7 @@ - Index — osxphotos 0.42.80 documentation + Index — osxphotos 0.42.82 documentation diff --git a/docs/index.html b/docs/index.html index dc8fc3b5..1c5d6d3e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,7 +5,7 @@ - Welcome to osxphotos’s documentation! — osxphotos 0.42.80 documentation + Welcome to osxphotos’s documentation! — osxphotos 0.42.82 documentation diff --git a/docs/modules.html b/docs/modules.html index 51c9bb2e..b9eedfa1 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -5,7 +5,7 @@ - osxphotos — osxphotos 0.42.80 documentation + osxphotos — osxphotos 0.42.82 documentation diff --git a/docs/reference.html b/docs/reference.html index f4ec17b3..bcc049b5 100644 --- a/docs/reference.html +++ b/docs/reference.html @@ -5,7 +5,7 @@ - osxphotos package — osxphotos 0.42.80 documentation + osxphotos package — osxphotos 0.42.82 documentation diff --git a/docs/search.html b/docs/search.html index 0af2253e..8f08d4bc 100644 --- a/docs/search.html +++ b/docs/search.html @@ -5,7 +5,7 @@ - Search — osxphotos 0.42.80 documentation + Search — osxphotos 0.42.82 documentation diff --git a/osxphotos/_version.py b/osxphotos/_version.py index c1fd7342..b352b1d4 100644 --- a/osxphotos/_version.py +++ b/osxphotos/_version.py @@ -1,3 +1,3 @@ """ version info """ -__version__ = "0.42.81" +__version__ = "0.42.82" diff --git a/osxphotos/photoinfo/_photoinfo_export.py b/osxphotos/photoinfo/_photoinfo_export.py index 4b413ee3..27ad1f2c 100644 --- a/osxphotos/photoinfo/_photoinfo_export.py +++ b/osxphotos/photoinfo/_photoinfo_export.py @@ -837,13 +837,18 @@ def export2( count = 1 glob_str = str(dest.parent / f"{dest.stem}*") dest_files = glob.glob(glob_str) - dest_files = [pathlib.Path(f).stem for f in dest_files] + dest_files = [normalize_fs_path(pathlib.Path(f).stem) for f in dest_files] dest_new = dest.stem - while dest_new in dest_files: + while normalize_fs_path(dest_new) in dest_files: dest_new = f"{dest.stem} ({count})" count += 1 dest = dest.parent / f"{dest_new}{dest.suffix}" + if export_original: + dest_original = dest + else: + dest_edited = dest + # export the dest file results = self._export_photo( src, diff --git a/tests/test_catalina_10_15_7.py b/tests/test_catalina_10_15_7.py index 782932de..c2da9947 100644 --- a/tests/test_catalina_10_15_7.py +++ b/tests/test_catalina_10_15_7.py @@ -183,13 +183,6 @@ UTI_ORIGINAL_DICT = { "1EB2B765-0765-43BA-A90C-0D0580E6172C": "public.jpeg", } -UUID_UNICODE_TITLE = [ - "B13F4485-94E0-41CD-AF71-913095D62E31", # Frítest.jpg - "1793FAAB-DE75-4E25-886C-2BD66C780D6A", # Frítest.jpg - "A8266C97-9BAF-4AF4-99F3-0013832869B8", # Frítest.jpg - "D1D4040D-D141-44E8-93EA-E403D9F63E07", # Frítest.jpg -] - RawInfo = namedtuple( "RawInfo", [ diff --git a/tests/test_cli.py b/tests/test_cli.py index 3b30adfc..c7a15762 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -93,6 +93,12 @@ CLI_EXPORT_FILENAMES = [ "screenshot-really-a-png.jpeg", "winebottle.jpeg", "winebottle (1).jpeg", + "Frítest.jpg", + "Frítest (1).jpg", + "Frítest (2).jpg", + "Frítest (3).jpg", + "Frítest_edited.jpeg", + "Frítest_edited (1).jpeg", ] @@ -120,6 +126,8 @@ CLI_EXPORT_FILENAMES_DRY_RUN = [ "screenshot-really-a-png.jpeg", "winebottle.jpeg", "winebottle.jpeg", + "Frítest.jpg", + "Frítest_edited.jpeg", ] CLI_EXPORT_IGNORE_SIGNATURE_FILENAMES = ["Tulips.jpg", "wedding.jpg"] @@ -160,6 +168,12 @@ CLI_EXPORT_FILENAMES_EDITED_SUFFIX = [ "screenshot-really-a-png.jpeg", "winebottle.jpeg", "winebottle (1).jpeg", + "Frítest.jpg", + "Frítest (1).jpg", + "Frítest (2).jpg", + "Frítest (3).jpg", + "Frítest_bearbeiten.jpeg", + "Frítest_bearbeiten (1).jpeg", ] CLI_EXPORT_FILENAMES_EDITED_SUFFIX_TEMPLATE = [ @@ -186,6 +200,12 @@ CLI_EXPORT_FILENAMES_EDITED_SUFFIX_TEMPLATE = [ "screenshot-really-a-png.jpeg", "winebottle.jpeg", "winebottle (1).jpeg", + "Frítest.jpg", + "Frítest (1).jpg", + "Frítest (2).jpg", + "Frítest (3).jpg", + "Frítest_edited.jpeg", + "Frítest_edited (1).jpeg", ] CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX = [ @@ -212,6 +232,12 @@ CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX = [ "screenshot-really-a-png_original.jpeg", "winebottle_original.jpeg", "winebottle_original (1).jpeg", + "Frítest_original.jpg", + "Frítest_original (1).jpg", + "Frítest_original (2).jpg", + "Frítest_original (3).jpg", + "Frítest_edited.jpeg", + "Frítest_edited (1).jpeg", ] CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX_TEMPLATE = [ @@ -238,6 +264,12 @@ CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX_TEMPLATE = [ "screenshot-really-a-png.jpeg", "winebottle.jpeg", "winebottle (1).jpeg", + "Frítest.jpg", + "Frítest (1).jpg", + "Frítest_original.jpg", + "Frítest_edited.jpeg", + "Frítest_original (1).jpg", + "Frítest_edited (1).jpeg", ] CLI_EXPORT_FILENAMES_CURRENT = [ @@ -264,6 +296,12 @@ CLI_EXPORT_FILENAMES_CURRENT = [ "D1359D09-1373-4F3B-B0E3-1A4DE573E4A3.mp4", "E2078879-A29C-4D6F-BACB-E3BBE6C3EB91.jpeg", "52083079-73D5-4921-AC1B-FE76F279133F.jpeg", + "B13F4485-94E0-41CD-AF71-913095D62E31.jpeg", # Frítest.jpg + "1793FAAB-DE75-4E25-886C-2BD66C780D6A.jpeg", # Frítest.jpg + "1793FAAB-DE75-4E25-886C-2BD66C780D6A_edited.jpeg", # Frítest.jpg + "A8266C97-9BAF-4AF4-99F3-0013832869B8.jpeg", # Frítest.jpg + "D1D4040D-D141-44E8-93EA-E403D9F63E07.jpeg", # Frítest.jpg + "D1D4040D-D141-44E8-93EA-E403D9F63E07_edited.jpeg", # Frítest.jpg ] CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG = [ @@ -290,6 +328,12 @@ CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG = [ "screenshot-really-a-png.jpeg", "winebottle.jpeg", "winebottle (1).jpeg", + "Frítest.jpg", + "Frítest (1).jpg", + "Frítest (2).jpg", + "Frítest (3).jpg", + "Frítest_edited (1).jpeg", + "Frítest_edited.jpeg", ] CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG_SKIP_RAW = [ @@ -314,6 +358,12 @@ CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG_SKIP_RAW = [ "screenshot-really-a-png.jpeg", "winebottle.jpeg", "winebottle (1).jpeg", + "Frítest.jpg", + "Frítest (1).jpg", + "Frítest (2).jpg", + "Frítest (3).jpg", + "Frítest_edited.jpeg", + "Frítest_edited (1).jpeg", ] CLI_EXPORT_CONVERT_TO_JPEG_LARGE_FILE = "DSC03584.jpeg" @@ -486,10 +536,10 @@ PHOTOS_NOT_IN_TRASH_LEN_14_6 = 12 PHOTOS_IN_TRASH_LEN_14_6 = 1 PHOTOS_MISSING_14_6 = 1 -PHOTOS_NOT_IN_TRASH_LEN_15_7 = 19 +PHOTOS_NOT_IN_TRASH_LEN_15_7 = 23 PHOTOS_IN_TRASH_LEN_15_7 = 2 PHOTOS_MISSING_15_7 = 2 -PHOTOS_EDITED_15_7 = 4 +PHOTOS_EDITED_15_7 = 6 CLI_PLACES_JSON = """{"places": {"_UNKNOWN_": 1, "Maui, Wailea, Hawai'i, United States": 1, "Washington, District of Columbia, United States": 1}}""" @@ -645,6 +695,15 @@ KEYWORDS_JSON = { "Val d'Isère": 2, "Drink": 2, "Wine Bottle": 2, + "Food": 2, + "Furniture": 2, + "Pizza": 2, + "Table": 2, + "Cloudy": 2, + "Cord": 2, + "Outdoor": 2, + "Sky": 2, + "Sunset Sunrise": 2, } } @@ -762,6 +821,10 @@ UUID_NOT_IN_ALBUM = [ "8846E3E6-8AC8-4857-8448-E3D025784410", "7F74DD34-5920-4DA3-B284-479887A34F66", "52083079-73D5-4921-AC1B-FE76F279133F", + "B13F4485-94E0-41CD-AF71-913095D62E31", # Frítest.jpg + "1793FAAB-DE75-4E25-886C-2BD66C780D6A", # Frítest.jpg + "A8266C97-9BAF-4AF4-99F3-0013832869B8", # Frítest.jpg + "D1D4040D-D141-44E8-93EA-E403D9F63E07", # Frítest.jpg ] UUID_DUPLICATES = [ @@ -4297,7 +4360,7 @@ def test_export_update_basic(): ) assert result.exit_code == 0 assert ( - "Processed: 19 photos, exported: 0, updated: 0, skipped: 23, updated EXIF data: 0, missing: 2, error: 0" + f"Processed: {PHOTOS_NOT_IN_TRASH_LEN_15_7} photos, exported: 0, updated: 0, skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}, updated EXIF data: 0, missing: 2, error: 0" in result.output ) @@ -4381,7 +4444,7 @@ def test_export_update_exiftool(): ) assert result.exit_code == 0 assert ( - "Processed: 19 photos, exported: 0, updated: 23, skipped: 0, updated EXIF data: 23, missing: 2, error: 1" + f"Processed: {PHOTOS_NOT_IN_TRASH_LEN_15_7} photos, exported: 0, updated: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}, skipped: 0, updated EXIF data: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}, missing: 2, error: 1" in result.output ) @@ -4391,7 +4454,7 @@ def test_export_update_exiftool(): ) assert result.exit_code == 0 assert ( - "Processed: 19 photos, exported: 0, updated: 0, skipped: 23, updated EXIF data: 0, missing: 2, error: 0" + f"Processed: {PHOTOS_NOT_IN_TRASH_LEN_15_7} photos, exported: 0, updated: 0, skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}, updated EXIF data: 0, missing: 2, error: 0" in result.output ) @@ -4428,7 +4491,7 @@ def test_export_update_hardlink(): ) assert result.exit_code == 0 assert ( - "Processed: 19 photos, exported: 0, updated: 23, skipped: 0, updated EXIF data: 0, missing: 2, error: 0" + f"Processed: {PHOTOS_NOT_IN_TRASH_LEN_15_7} photos, exported: 0, updated: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}, skipped: 0, updated EXIF data: 0, missing: 2, error: 0" in result.output ) assert not os.path.samefile(CLI_EXPORT_UUID_FILENAME, photo.path) @@ -4467,7 +4530,7 @@ def test_export_update_hardlink_exiftool(): ) assert result.exit_code == 0 assert ( - "Processed: 19 photos, exported: 0, updated: 23, skipped: 0, updated EXIF data: 23, missing: 2, error: 1" + f"Processed: {PHOTOS_NOT_IN_TRASH_LEN_15_7} photos, exported: 0, updated: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}, skipped: 0, updated EXIF data: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}, missing: 2, error: 1" in result.output ) assert not os.path.samefile(CLI_EXPORT_UUID_FILENAME, photo.path) @@ -4553,7 +4616,7 @@ def test_export_update_only_new(): ], ) assert result.exit_code == 0 - assert "exported: 1" in result.output + assert "exported: 7" in result.output # --update with --only-new result = runner.invoke( @@ -4561,7 +4624,7 @@ def test_export_update_only_new(): [os.path.join(cwd, PHOTOS_DB_15_7), ".", "-V", "--update", "--only-new"], ) assert result.exit_code == 0 - assert "exported: 1" in result.output + assert "exported: 7" in result.output # --update with --only-new, should export nothing result = runner.invoke( @@ -4603,7 +4666,7 @@ def test_export_update_no_db(): # edited files will be re-exported because there won't be an edited signature # in the database assert ( - "Processed: 19 photos, exported: 0, updated: 4, skipped: 19, updated EXIF data: 0, missing: 2, error: 0" + f"Processed: {PHOTOS_NOT_IN_TRASH_LEN_15_7} photos, exported: 0, updated: {PHOTOS_EDITED_15_7}, skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7}, updated EXIF data: 0, missing: 2, error: 0" in result.output ) assert os.path.isfile(OSXPHOTOS_EXPORT_DB) @@ -4643,7 +4706,8 @@ def test_export_then_hardlink(): ) assert result.exit_code == 0 assert ( - "Processed: 19 photos, exported: 23, missing: 2, error: 0" in result.output + f"Processed: {PHOTOS_NOT_IN_TRASH_LEN_15_7} photos, exported: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}, missing: 2, error: 0" + in result.output ) assert os.path.samefile(CLI_EXPORT_UUID_FILENAME, photo.path) @@ -4656,6 +4720,7 @@ def test_export_dry_run(): import osxphotos from osxphotos.cli import export + from osxphotos.utils import normalize_fs_path runner = CliRunner() cwd = os.getcwd() @@ -4666,11 +4731,12 @@ def test_export_dry_run(): ) assert result.exit_code == 0 assert ( - "Processed: 19 photos, exported: 23, missing: 2, error: 0" in result.output + f"Processed: {PHOTOS_NOT_IN_TRASH_LEN_15_7} photos, exported: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}, missing: 2, error: 0" + in result.output ) for filepath in CLI_EXPORT_FILENAMES_DRY_RUN: assert re.search(r"Exported.*" + f"{filepath}", result.output) - assert not os.path.isfile(filepath) + assert not os.path.isfile(normalize_fs_path(filepath)) def test_export_update_edits_dry_run(): @@ -4747,7 +4813,10 @@ def test_export_directory_template_1_dry_run(): ], ) assert result.exit_code == 0 - assert "exported: 23" in result.output + assert ( + f"exported: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" + in result.output + ) workdir = os.getcwd() for filepath in CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES1: assert re.search(r"Exported.*" + f"{filepath}", result.output) @@ -4783,8 +4852,14 @@ def test_export_touch_files(): ) assert result.exit_code == 0 - assert "exported: 23" in result.output - assert "touched date: 21" in result.output + assert ( + f"exported: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" + in result.output + ) + assert ( + f"touched date: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7-2}" + in result.output + ) for fname, mtime in zip(CLI_EXPORT_BY_DATE, CLI_EXPORT_BY_DATE_TOUCH_TIMES): st = os.stat(fname) @@ -4816,7 +4891,10 @@ def test_export_touch_files_update(): ) assert result.exit_code == 0 - assert "exported: 23" in result.output + assert ( + f"exported: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" + in result.output + ) assert not pathlib.Path(CLI_EXPORT_BY_DATE[0]).is_file() @@ -4826,7 +4904,10 @@ def test_export_touch_files_update(): ) assert result.exit_code == 0 - assert "exported: 23" in result.output + assert ( + f"exported: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" + in result.output + ) assert pathlib.Path(CLI_EXPORT_BY_DATE[0]).is_file() @@ -4837,7 +4918,10 @@ def test_export_touch_files_update(): ) assert result.exit_code == 0 - assert "skipped: 23" in result.output + assert ( + f"skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" + in result.output + ) # --update --touch-file --dry-run result = runner.invoke( @@ -4852,8 +4936,14 @@ def test_export_touch_files_update(): ], ) assert result.exit_code == 0 - assert "skipped: 23" in result.output - assert "touched date: 21" in result.output + assert ( + f"skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" + in result.output + ) + assert ( + f"touched date: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7-2}" + in result.output + ) for fname, mtime in zip( CLI_EXPORT_BY_DATE_NEED_TOUCH, CLI_EXPORT_BY_DATE_NEED_TOUCH_TIMES @@ -4873,8 +4963,14 @@ def test_export_touch_files_update(): ], ) assert result.exit_code == 0 - assert "skipped: 23" in result.output - assert "touched date: 21" in result.output + assert ( + f"skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" + in result.output + ) + assert ( + f"touched date: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7-2}" + in result.output + ) for fname, mtime in zip( CLI_EXPORT_BY_DATE_NEED_TOUCH, CLI_EXPORT_BY_DATE_NEED_TOUCH_TIMES @@ -4897,7 +4993,7 @@ def test_export_touch_files_update(): ], ) assert result.exit_code == 0 - assert "updated: 1, skipped: 22" in result.output + assert f"updated: 1, skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7-1}" in result.output assert "touched date: 1" in result.output for fname, mtime in zip(CLI_EXPORT_BY_DATE, CLI_EXPORT_BY_DATE_TOUCH_TIMES): @@ -4911,7 +5007,10 @@ def test_export_touch_files_update(): ) assert result.exit_code == 0 - assert "skipped: 23" in result.output + assert ( + f"skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" + in result.output + ) @pytest.mark.skip("TODO: This fails on some machines but not all") @@ -6551,7 +6650,7 @@ def test_query_min_size_1(): assert result.exit_code == 0 json_got = json.loads(result.output) - assert len(json_got) == 2 + assert len(json_got) == 4 def test_query_min_size_2(): @@ -6578,7 +6677,7 @@ def test_query_min_size_2(): assert result.exit_code == 0 json_got = json.loads(result.output) - assert len(json_got) == 2 + assert len(json_got) == 4 def test_query_max_size_1(): @@ -6599,7 +6698,7 @@ def test_query_max_size_1(): assert result.exit_code == 0 json_got = json.loads(result.output) - assert len(json_got) == 1 + assert len(json_got) == 3 def test_query_max_size_2(): @@ -6620,7 +6719,7 @@ def test_query_max_size_2(): assert result.exit_code == 0 json_got = json.loads(result.output) - assert len(json_got) == 1 + assert len(json_got) == 3 def test_query_min_max_size():