Skip to content

Commit

Permalink
disable tests for DECODE_THREADS on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 committed Dec 15, 2022
1 parent b4d67a1 commit d142345
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/analysis-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ jobs:
coverage-macos:
runs-on: macos-12
name: Coverage(macOS)
env:
TEST_DECODE_THREADS: 0 # Till `brew` update to `1.14.1`

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -188,6 +190,8 @@ jobs:
coverage-pi-heif:
runs-on: macos-12
name: Pi-Heif Coverage(macOS)
env:
TEST_DECODE_THREADS: 0 # Till `brew` update to `1.14.1`

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -236,6 +240,7 @@ jobs:
env:
EXP_PH_LIBHEIF_VERSION: ""
PH_LIGHT_ACTION: 1
TEST_DECODE_THREADS: 0 # Till `brew` update to `1.14.1`

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi-pi_heif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
CIBW_BUILD: "*-macosx_x86_64"
CIBW_SKIP: "cp36-* pp39-*"
CIBW_TEST_SKIP: "cp311-*"
CIBW_ENVIRONMENT_MACOS: PH_LIGHT_ACTION=1
CIBW_ENVIRONMENT_MACOS: PH_LIGHT_ACTION=1 TEST_DECODE_THREADS=0

- name: Checking built wheels
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
CIBW_BUILD: "*-macosx_x86_64"
CIBW_SKIP: "cp36-* pp39-*"
CIBW_TEST_SKIP: "cp311-*"
CIBW_ENVIRONMENT_MACOS: PH_FULL_ACTION=1
CIBW_ENVIRONMENT_MACOS: PH_FULL_ACTION=1 TEST_DECODE_THREADS=0

- name: Check built wheels
run: |
Expand Down
4 changes: 3 additions & 1 deletion pillow_heif/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
DECODE_THREADS = 4
"""Maximum number of threads to use for decoding images(when it is possible)
When use pillow_heif as a plugin you can set it with: `register_*_opener(decode_threads=8)`"""
When use pillow_heif as a plugin you can set it with: `register_*_opener(decode_threads=8)`
.. note:: Currently do not work on macOS, will be fixed in `0.9.1` version"""


THUMBNAILS = True
Expand Down
10 changes: 5 additions & 5 deletions tests/options_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ def test_decode_threads():
start_time_one_thread = perf_counter()
open_heif(test_image, convert_hdr_to_8bit=False).load()
total_time_one_thread = perf_counter() - start_time_one_thread
options.DECODE_THREADS = 2
start_time_two_threads = perf_counter()
options.DECODE_THREADS = os.cpu_count()
start_time_multiply_threads = perf_counter()
open_heif(test_image, convert_hdr_to_8bit=False).load()
total_time_two_threads = perf_counter() - start_time_two_threads
# decoding in two threads should be faster at least by 8%
assert total_time_one_thread > total_time_two_threads * 1.08
total_time_multiply_threads = perf_counter() - start_time_multiply_threads
# decoding in multiply threads should be faster at least by 15%
assert total_time_one_thread > total_time_multiply_threads * 1.15
finally:
options.DECODE_THREADS = 4

Expand Down

0 comments on commit d142345

Please sign in to comment.