RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
2.04k stars 95 forks source link

pytest results on Monterey M1 #543

Open narensankar0529 opened 2 years ago

narensankar0529 commented 2 years ago

============================================================ FAILURES ============================================================ ____ test_get_preferred_uti_extension ____

def test_get_preferred_uti_extension():
    """test get_preferred_uti_extension"""
    for uti in UTI_DICT:
      assert get_preferred_uti_extension(uti) == UTI_DICT[uti]

E AssertionError: assert 'jpg' == 'jpeg' E - jpeg E ? - E + jpg

tests/test_uti.py:19: AssertionError ____ test_get_preferred_uti_extension_no_objc ____

def test_get_preferred_uti_extension_no_objc():
    """test get_preferred_uti_extension when running on macOS >= 12"""
    OLD_VER = osxphotos.uti.OS_VER
    osxphotos.uti.OS_VER = 12
    for uti in UTI_DICT:
      assert get_preferred_uti_extension(uti) == UTI_DICT[uti]

E AssertionError: assert 'jpg' == 'jpeg' E - jpeg E ? - E + jpg

tests/test_uti.py:33: AssertionError ==================================================== short test summary info ===================================================== FAILED tests/test_uti.py::test_get_preferred_uti_extension - AssertionError: assert 'jpg' == 'jpeg' FAILED tests/test_uti.py::test_get_preferred_uti_extension_no_objc - AssertionError: assert 'jpg' == 'jpeg' =========================================== 2 failed, 998 passed, 74 skipped in 31.32s =========================================== monterey_test.txt

RhetTbull commented 2 years ago

Thanks for the test results! These two also failed on Big Sur on M1. I haven't yet figure out why they're failing. These won't affect performance of osxphotos except that in certain cases, some JPEG images may be exported as .jpg whereas on Intel Macs, they would be exported as .jpeg.

narensankar0529 commented 2 years ago

Yeah. So you can mark osxphotos as working on Monterey for now.

RhetTbull commented 2 years ago

What is the version number of Photos in Photos | About Photos on Monterey? I'm assuming it's 7.0 but want to confirm.

RhetTbull commented 2 years ago

@narensankar0529 since you have the tests data downloaded would you be able to copy the tests/Test-10.16.0.1.photoslibrary library out of the test library then open in Photos? (hold down Option as Photos is loading to select a different library). Photos will convert it to a Monterey formatted library then quit photos, zip the library and post it here? That would let allow me to expand the test suite for Monterey.

narensankar0529 commented 2 years ago

Version 7.0 (411.0.120)

narensankar0529 commented 2 years ago

Unable to add zip file to issue. So I have shared from iCloud Drive. Let me know if any issues

https://www.icloud.com/iclouddrive/0tTAKtE_LvOoNk541z2E7AiXw#Test-10.16.0.1

RhetTbull commented 2 years ago

Thanks! Got it -- added this as a test library to the test suite. All the tests are running correctly against this test library. I just need to figure out the jpg/jpeg issue.

RhetTbull commented 2 years ago

@narensankar0529 Some users are reporting issues with --convert-to-jpeg on Monterey and I realized these tests are disabled by default (because they won't run in the GitHub continuous integration automated test environment which lacks GPU) thus they didn't get tested when you ran your tests. Would you mind doing the following and sending me output?

git pull
OSXPHOTOS_TEST_CONVERT=1 pytest -vv -k convert > test_results.txt
narensankar0529 commented 2 years ago

============================= test session starts ============================== platform darwin -- Python 3.9.9, pytest-6.2.4, py-1.11.0, pluggy-0.13.1 -- /Users/nsankar/projects/osxphotos/.venv/bin/python3 cachedir: .pytest_cache rootdir: /Users/nsankar/projects/osxphotos plugins: mock-3.6.1 collecting ... collected 1154 items / 1138 deselected / 16 selected

tests/test_cli.py::test_export_convert_to_jpeg PASSED [ 6%] tests/test_cli.py::test_export_convert_to_jpeg_quality PASSED [ 12%] tests/test_cli.py::test_export_convert_to_jpeg_skip_raw PASSED [ 18%] tests/test_cli.py::test_export_jpeg_ext_convert_to_jpeg PASSED [ 25%] tests/test_cli.py::test_export_jpeg_ext_convert_to_jpeg_movie PASSED [ 31%] tests/test_export_convert_to_jpeg.py::test_export_convert_raw_to_jpeg PASSED [ 37%] tests/test_export_convert_to_jpeg.py::test_export_convert_heic_to_jpeg PASSED [ 43%] tests/test_export_convert_to_jpeg.py::test_export_convert_live_heic_to_jpeg SKIPPED [ 50%] tests/test_fileutil.py::test_convert_to_jpeg PASSED [ 56%] tests/test_fileutil.py::test_convert_to_jpeg_quality PASSED [ 62%] tests/test_image_converter.py::test_image_converter_singleton PASSED [ 68%] tests/test_image_converter.py::test_image_converter PASSED [ 75%] tests/test_image_converter.py::test_image_converter_compression_quality PASSED [ 81%] tests/test_image_converter.py::test_image_converter_bad_compression_quality PASSED [ 87%] tests/test_image_converter.py::test_image_converter_bad_file PASSED [ 93%] tests/test_image_converter.py::test_image_converter_missing_file PASSED [100%]

================ 15 passed, 1 skipped, 1138 deselected in 9.49s ================

narensankar0529 commented 2 years ago

Full run using pytest -

1080 passed, 74 skipped in 33.90s

So everything passes on M1 Monterey now

RhetTbull commented 2 years ago

Thanks!

RhetTbull commented 2 years ago

1080 passed, 74 skipped in 33.90s

Wow...that's fast. My 2013 MacBook Pro runs the test suite about 10x slower!

1141 passed, 13 skipped in 379.68s (0:06:19)

narensankar0529 commented 2 years ago

on x64 Monterey get one warning -

================================================================= warnings summary ================================================================= .venv/lib/python3.9/site-packages/photoscript-0.1.5-py3.9.egg/photoscript/init.py:120 /Users/nsankar/Projects/osxphotos/.venv/lib/python3.9/site-packages/photoscript-0.1.5-py3.9.egg/photoscript/init.py:120: DeprecationWarning: invalid escape sequence _ """Returns a generator that yields Photo objects

-- Docs: https://docs.pytest.org/en/stable/warnings.html ============================================== 1080 passed, 74 skipped, 1 warning in 81.55s (0:01:21) ==============================================

narensankar0529 commented 2 years ago

x86 Monterey convert tests -

OSXPHOTOS_TEST_CONVERT=1 pytest -vv -k convert =============================================================== test session starts ================================================================ platform darwin -- Python 3.9.6, pytest-6.2.4, py-1.11.0, pluggy-0.13.1 -- /Users/nsankar/Projects/osxphotos/.venv/bin/python3 cachedir: .pytest_cache rootdir: /Users/nsankar/Projects/osxphotos plugins: mock-3.6.1 collected 1154 items / 1138 deselected / 16 selected

tests/test_cli.py::test_export_convert_to_jpeg PASSED [ 6%] tests/test_cli.py::test_export_convert_to_jpeg_quality PASSED [ 12%] tests/test_cli.py::test_export_convert_to_jpeg_skip_raw PASSED [ 18%] tests/test_cli.py::test_export_jpeg_ext_convert_to_jpeg PASSED [ 25%] tests/test_cli.py::test_export_jpeg_ext_convert_to_jpeg_movie PASSED [ 31%] tests/test_export_convert_to_jpeg.py::test_export_convert_raw_to_jpeg PASSED [ 37%] tests/test_export_convert_to_jpeg.py::test_export_convert_heic_to_jpeg PASSED [ 43%] tests/test_export_convert_to_jpeg.py::test_export_convert_live_heic_to_jpeg SKIPPED (Skip if not running against author's personal library) [ 50%] tests/test_fileutil.py::test_convert_to_jpeg PASSED [ 56%] tests/test_fileutil.py::test_convert_to_jpeg_quality PASSED [ 62%] tests/test_image_converter.py::test_image_converter_singleton PASSED [ 68%] tests/test_image_converter.py::test_image_converter PASSED [ 75%] tests/test_image_converter.py::test_image_converter_compression_quality PASSED [ 81%] tests/test_image_converter.py::test_image_converter_bad_compression_quality PASSED [ 87%] tests/test_image_converter.py::test_image_converter_bad_file PASSED [ 93%] tests/test_image_converter.py::test_image_converter_missing_file PASSED [100%]

================================================= 15 passed, 1 skipped, 1138 deselected in 18.50s ==================================================

narensankar0529 commented 2 years ago

1080 passed, 74 skipped in 33.90s

Wow...that's fast. My 2013 MacBook Pro runs the test suite about 10x slower!

1141 passed, 13 skipped in 379.68s (0:06:19)

Yeah my 2019 MacBook Pro i9 runs three times slower compared to my M1 Mac mini for these tests