File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ import os
1
2
import re
2
3
from functools import partial
3
4
@@ -76,7 +77,7 @@ def test_get_namespace_ndarray_with_dispatch():
76
77
77
78
78
79
@skip_if_array_api_compat_not_configured
79
- def test_get_namespace_array_api ():
80
+ def test_get_namespace_array_api (monkeypatch ):
80
81
"""Test get_namespace for ArrayAPI arrays."""
81
82
xp = pytest .importorskip ("array_api_strict" )
82
83
@@ -89,6 +90,19 @@ def test_get_namespace_array_api():
89
90
with pytest .raises (TypeError ):
90
91
xp_out , is_array_api_compliant = get_namespace (X_xp , X_np )
91
92
93
+ def mock_getenv (key ):
94
+ if key == "SCIPY_ARRAY_API" :
95
+ return "0"
96
+ return None
97
+
98
+ monkeypatch .setattr ("os.environ.get" , mock_getenv )
99
+ assert os .environ .get ("SCIPY_ARRAY_API" ) != "1"
100
+ with pytest .warns (
101
+ UserWarning ,
102
+ match = "enabling SciPy's own support for array API to function properly. " ,
103
+ ):
104
+ xp_out , is_array_api_compliant = get_namespace (X_xp )
105
+
92
106
93
107
class _AdjustableNameAPITestWrapper (_ArrayAPIWrapper ):
94
108
"""API wrapper that has an adjustable name. Used for testing."""
You can’t perform that action at this time.
0 commit comments