File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
light-curve/tests/light_curve_ext Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 11import copy
22import inspect
33import pickle
4+ from concurrent .futures import ThreadPoolExecutor
45
56import numpy as np
67import pytest
@@ -174,7 +175,24 @@ def test_many_vs_call(feature):
174175
175176 call = np .stack ([feature (* lc , sorted = True ) for lc in lcs ])
176177 many = feature .many (lcs , sorted = True , n_jobs = 2 )
177- assert_array_equal (many , call )
178+ assert_array_equal (call , many )
179+
180+ # Test with Python threads to ensure we have no problems on the free-threading CPython
181+ with ThreadPoolExecutor (2 ) as pool :
182+ futures = [pool .submit (feature , * lc , sorted = True ) for lc in lcs ]
183+ call_threads = np .stack ([f .result () for f in futures ])
184+ del futures
185+ assert_array_equal (call , call_threads )
186+
187+ n_lcs_per_job = 4
188+ with ThreadPoolExecutor (2 ) as pool :
189+ futures = [
190+ pool .submit (feature .many , lcs [i : i + n_lcs_per_job ], sorted = True , n_jobs = 2 )
191+ for i in range (0 , n_lc , n_lcs_per_job )
192+ ]
193+ many_threads = np .concatenate ([f .result () for f in futures ])
194+ del futures
195+ assert_array_equal (call , many_threads )
178196
179197
180198def test_fill_value_not_enough_observations ():
You can’t perform that action at this time.
0 commit comments