--convert-to-jpeg initial version working

This commit is contained in:
Rhet Turnbull
2020-10-02 06:31:20 -07:00
parent ddc1e69b4a
commit 38f201d0fb
12 changed files with 600 additions and 121 deletions

View File

@@ -2,6 +2,7 @@
import pytest
TEST_HEIC = "tests/test-images/IMG_3092.heic"
def test_copy_file_valid():
# copy file with valid src, dest
@@ -67,3 +68,15 @@ def test_unlink_file():
assert os.path.isfile(dest)
FileUtil.unlink(dest)
assert not os.path.isfile(dest)
def test_convert_to_jpeg():
import pathlib
import tempfile
from osxphotos.fileutil import FileUtil
temp_dir = tempfile.TemporaryDirectory(prefix="osxphotos_")
with temp_dir:
imgfile = pathlib.Path(TEST_HEIC)
outfile = pathlib.Path(temp_dir.name) / f"{imgfile.stem}.jpeg"
assert FileUtil.convert_to_jpeg(imgfile, outfile)
assert outfile.is_file()