Merge branch 'master' into convert_to_jpeg
This commit is contained in:
@@ -235,8 +235,8 @@ CLI_EXPORT_UUID_STATUE = "3DD2C897-F19E-4CA6-8C22-B027D5A71907"
|
||||
CLI_EXPORT_UUID_FILENAME = "Pumkins2.jpg"
|
||||
|
||||
CLI_EXPORT_BY_DATE_TOUCH_UUID = [
|
||||
"1EB2B765-0765-43BA-A90C-0D0580E6172C",
|
||||
"F12384F6-CD17-4151-ACBA-AE0E3688539E",
|
||||
"1EB2B765-0765-43BA-A90C-0D0580E6172C", # Pumpkins3.jpg
|
||||
"F12384F6-CD17-4151-ACBA-AE0E3688539E", # Pumkins1.jpg
|
||||
]
|
||||
CLI_EXPORT_BY_DATE_TOUCH_TIMES = [1538165373, 1538163349]
|
||||
CLI_EXPORT_BY_DATE_NEED_TOUCH = [
|
||||
@@ -399,6 +399,7 @@ CLI_EXPORT_UUID_FROM_FILE_FILENAMES = [
|
||||
"wedding_edited.jpeg",
|
||||
]
|
||||
|
||||
|
||||
# determine if exiftool installed so exiftool tests can be skipped
|
||||
try:
|
||||
exiftool = get_exiftool_path()
|
||||
@@ -407,9 +408,9 @@ except:
|
||||
|
||||
|
||||
def touch_all_photos_in_db(dbpath):
|
||||
""" touch date on all photos in a library
|
||||
"""touch date on all photos in a library
|
||||
helper function for --touch-file tests
|
||||
|
||||
|
||||
Args:
|
||||
dbpath: path to photos library to touch
|
||||
"""
|
||||
@@ -437,13 +438,14 @@ def setup_touch_tests():
|
||||
import logging
|
||||
import osxphotos
|
||||
|
||||
# touch all photos so they do not match PhotoInfo.date
|
||||
touch_all_photos_in_db(PHOTOS_DB_TOUCH)
|
||||
|
||||
# adjust a couple of the photos so they're file times *are* correct
|
||||
photos = osxphotos.PhotosDB(PHOTOS_DB_TOUCH).photos_by_uuid(
|
||||
CLI_EXPORT_BY_DATE_TOUCH_UUID
|
||||
)
|
||||
for photo in photos:
|
||||
logging.warning(photo.path)
|
||||
ts = int(photo.date.timestamp())
|
||||
if photo.path is not None:
|
||||
os.utime(photo.path, (ts, ts))
|
||||
@@ -3091,9 +3093,10 @@ def test_export_touch_files_update():
|
||||
)
|
||||
|
||||
|
||||
# @pytest.mark.skip("TODO: This fails on some machines but not all")
|
||||
@pytest.mark.skipif(exiftool is None, reason="exiftool not installed")
|
||||
def test_export_touch_files_exiftool_update():
|
||||
""" test complex export scenario with --update, --exiftol, and --touch-files """
|
||||
""" test complex export scenario with --update, --exiftool, and --touch-files """
|
||||
import os
|
||||
import pathlib
|
||||
import time
|
||||
@@ -3199,10 +3202,6 @@ def test_export_touch_files_exiftool_update():
|
||||
in result.output
|
||||
)
|
||||
|
||||
for fname, mtime in zip(CLI_EXPORT_BY_DATE, CLI_EXPORT_BY_DATE_TOUCH_TIMES):
|
||||
st = os.stat(fname)
|
||||
assert int(st.st_mtime) != int(mtime)
|
||||
|
||||
# --update --touch-file --exiftool
|
||||
result = runner.invoke(
|
||||
export,
|
||||
|
||||
Reference in New Issue
Block a user