8000 Merge pull request #26151 from Vogtinator/featuretest · numpy/numpy@6ecfb44 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ecfb44

Browse files
authored
Merge pull request #26151 from Vogtinator/featuretest
BUG: Fix test_impossible_feature_enable failing without BASELINE_FEAT
2 parents 50a705c + f883969 commit 6ecfb44

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

numpy/_core/src/common/npy_cpu_features.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ npy__cpu_check_env(int disable, const char *env) {
326326
) < 0) {
327327
return -1;
328328
}
329-
return 0;
330329
}
331330

332331
#define NOTSUPP_BODY \

numpy/_core/tests/test_cpu_features.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,25 @@ def test_impossible_feature_enable(self):
311311
err_type = "RuntimeError"
312312
self._expect_error(msg, err_type)
313313

314-
# Ensure that only the bad feature gets reported
315-
feats = f"{bad_feature}, {self.BASELINE_FEAT}"
314+
# Ensure that it fails even when providing garbage in addition
315+
feats = f"{bad_feature}, Foobar"
316316
self.env['NPY_ENABLE_CPU_FEATURES'] = feats
317317
msg = (
318318
f"You cannot enable CPU features \\({bad_feature}\\), since they "
319319
"are not supported by your machine."
320320
)
321321
self._expect_error(msg, err_type)
322322

323+
if self.BASELINE_FEAT is not None:
324+
# Ensure that only the bad feature gets reported
325+
feats = f"{bad_feature}, {self.BASELINE_FEAT}"
326+
self.env['NPY_ENABLE_CPU_FEATURES'] = feats
327+
msg = (
328+
f"You cannot enable CPU features \\({bad_feature}\\), since "
329+
"they are not supported by your machine."
330+
)
331+
self._expect_error(msg, err_type)
332+
323333
is_linux = sys.platform.startswith('linux')
324334
is_cygwin = sys.platform.startswith('cygwin')
325335
machine = platform.machine()

0 commit comments

Comments
 (0)
0