Skip to content

Commit 1e47e47

Browse files
Merge pull request #484 from avalentino/bugfix/fix-nthreads-test
Fix tests on nthreads detection (closes: #479)
2 parents cb7aed5 + 0b4d58f commit 1e47e47

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

numexpr/tests/test_numexpr.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
double = np.double
4343
long = int
44+
MAX_THREADS = 8
4445

4546

4647
class test_numexpr(TestCase):
@@ -1164,14 +1165,14 @@ def test_omp_num_threads_empty_string(self):
11641165
if 'sparc' in platform.machine():
11651166
self.assertEqual(1, numexpr._init_num_threads())
11661167
else:
1167-
self.assertEqual(detect_number_of_cores(), numexpr._init_num_threads())
1168+
self.assertEqual(min(detect_number_of_cores(), MAX_THREADS), numexpr._init_num_threads())
11681169

11691170
def test_numexpr_max_threads_empty_string(self):
11701171
with _environment('NUMEXPR_MAX_THREADS', ''):
11711172
if 'sparc' in platform.machine():
11721173
self.assertEqual(1, numexpr._init_num_threads())
11731174
else:
1174-
self.assertEqual(detect_number_of_cores(), numexpr._init_num_threads())
1175+
self.assertEqual(min(detect_number_of_cores(), MAX_THREADS), numexpr._init_num_threads())
11751176

11761177
def test_vml_threads_round_trip(self):
11771178
n_threads = 3

0 commit comments

Comments
 (0)