diff --git a/osxphotos/imageconverter.py b/osxphotos/imageconverter.py index e3fdc358..061dd3da 100644 --- a/osxphotos/imageconverter.py +++ b/osxphotos/imageconverter.py @@ -1,6 +1,6 @@ """ ImageConverter class Convert an image to JPEG using CoreImage -- - for example, RAW to JPEG """ + for example, RAW to JPEG. Only works if Mac equipped with GPU. """ # reference: https://stackoverflow.com/questions/59330149/coreimage-ciimage-write-jpg-is-shifting-colors-macos/59334308#59334308 diff --git a/tests/test_cli.py b/tests/test_cli.py index e4eca0b2..1e75c540 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -840,6 +840,10 @@ def test_export_edited_suffix(): assert sorted(files) == sorted(CLI_EXPORT_FILENAMES_EDITED_SUFFIX) +@pytest.mark.skipif( + "OSXPHOTOS_TEST_CONVERT" not in os.environ, + reason="Skip if running in Github actions, no GPU.", +) def test_export_convert_to_jpeg(): """ test --convert-to-jpeg """ import glob @@ -862,6 +866,10 @@ def test_export_convert_to_jpeg(): assert large_file.stat().st_size > 10000000 +@pytest.mark.skipif( + "OSXPHOTOS_TEST_CONVERT" not in os.environ, + reason="Skip if running in Github actions, no GPU.", +) def test_export_convert_to_jpeg_quality(): """ test --convert-to-jpeg --jpeg-quality """ import glob diff --git a/tests/test_export_convert_to_jpeg.py b/tests/test_export_convert_to_jpeg.py index 578a7ef5..e992b15e 100644 --- a/tests/test_export_convert_to_jpeg.py +++ b/tests/test_export_convert_to_jpeg.py @@ -1,7 +1,13 @@ +import os import pytest from osxphotos._constants import _UNKNOWN_PERSON +skip_test = "OSXPHOTOS_TEST_CONVERT" not in os.environ +pytestmark = pytest.mark.skipif( + skip_test, reason="Skip if running on GitHub actions, no GPU." +) + PHOTOS_DB = "tests/Test-10.15.6.photoslibrary" UUID_DICT = { diff --git a/tests/test_fileutil.py b/tests/test_fileutil.py index 334fd228..474d04b5 100644 --- a/tests/test_fileutil.py +++ b/tests/test_fileutil.py @@ -1,5 +1,6 @@ """ test FileUtil """ +import os import pytest TEST_HEIC = "tests/test-images/IMG_3092.heic" @@ -72,6 +73,10 @@ def test_unlink_file(): assert not os.path.isfile(dest) +@pytest.mark.skipif( + "OSXPHOTOS_TEST_CONVERT" not in os.environ, + reason="Skip if running in Github actions, no GPU.", +) def test_convert_to_jpeg(): """ test convert_to_jpeg """ import pathlib @@ -85,7 +90,10 @@ def test_convert_to_jpeg(): assert FileUtil.convert_to_jpeg(imgfile, outfile) assert outfile.is_file() - +@pytest.mark.skipif( + "OSXPHOTOS_TEST_CONVERT" not in os.environ, + reason="Skip if running in Github actions, no GPU.", +) def test_convert_to_jpeg_quality(): """ test convert_to_jpeg with compression_quality """ import pathlib