Skip to content

Commit d142345

Browse files
committed
disable tests for DECODE_THREADS on macOS
1 parent b4d67a1 commit d142345

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

.github/workflows/analysis-coverage.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ jobs:
9090
coverage-macos:
9191
runs-on: macos-12
9292
name: Coverage(macOS)
93+
env:
94+
TEST_DECODE_THREADS: 0 # Till `brew` update to `1.14.1`
9395

9496
steps:
9597
- uses: actions/checkout@v3
@@ -188,6 +190,8 @@ jobs:
188190
coverage-pi-heif:
189191
runs-on: macos-12
190192
name: Pi-Heif Coverage(macOS)
193+
env:
194+
TEST_DECODE_THREADS: 0 # Till `brew` update to `1.14.1`
191195

192196
steps:
193197
- uses: actions/checkout@v3
@@ -236,6 +240,7 @@ jobs:
236240
env:
237241
EXP_PH_LIBHEIF_VERSION: ""
238242
PH_LIGHT_ACTION: 1
243+
TEST_DECODE_THREADS: 0 # Till `brew` update to `1.14.1`
239244

240245
steps:
241246
- uses: actions/checkout@v3

.github/workflows/publish-pypi-pi_heif.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
CIBW_BUILD: "*-macosx_x86_64"
8181
CIBW_SKIP: "cp36-* pp39-*"
8282
CIBW_TEST_SKIP: "cp311-*"
83-
CIBW_ENVIRONMENT_MACOS: PH_LIGHT_ACTION=1
83+
CIBW_ENVIRONMENT_MACOS: PH_LIGHT_ACTION=1 TEST_DECODE_THREADS=0
8484

8585
- name: Checking built wheels
8686
run: |

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
CIBW_BUILD: "*-macosx_x86_64"
107107
CIBW_SKIP: "cp36-* pp39-*"
108108
CIBW_TEST_SKIP: "cp311-*"
109-
CIBW_ENVIRONMENT_MACOS: PH_FULL_ACTION=1
109+
CIBW_ENVIRONMENT_MACOS: PH_FULL_ACTION=1 TEST_DECODE_THREADS=0
110110

111111
- name: Check built wheels
112112
run: |

pillow_heif/options.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
DECODE_THREADS = 4
77
"""Maximum number of threads to use for decoding images(when it is possible)
88
9-
When use pillow_heif as a plugin you can set it with: `register_*_opener(decode_threads=8)`"""
9+
When use pillow_heif as a plugin you can set it with: `register_*_opener(decode_threads=8)`
10+
11+
.. note:: Currently do not work on macOS, will be fixed in `0.9.1` version"""
1012

1113

1214
THUMBNAILS = True

tests/options_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ def test_decode_threads():
8383
start_time_one_thread = perf_counter()
8484
open_heif(test_image, convert_hdr_to_8bit=False).load()
8585
total_time_one_thread = perf_counter() - start_time_one_thread
86-
options.DECODE_THREADS = 2
87-
start_time_two_threads = perf_counter()
86+
options.DECODE_THREADS = os.cpu_count()
87+
start_time_multiply_threads = perf_counter()
8888
open_heif(test_image, convert_hdr_to_8bit=False).load()
89-
total_time_two_threads = perf_counter() - start_time_two_threads
90-
# decoding in two threads should be faster at least by 8%
91-
assert total_time_one_thread > total_time_two_threads * 1.08
89+
total_time_multiply_threads = perf_counter() - start_time_multiply_threads
90+
# decoding in multiply threads should be faster at least by 15%
91+
assert total_time_one_thread > total_time_multiply_threads * 1.15
9292
finally:
9393
options.DECODE_THREADS = 4
9494

0 commit comments

Comments
 (0)