summaryrefslogtreecommitdiff
path: root/numpy/distutils/tests/test_system_info.py
diff options
context:
space:
mode:
authorNick R. Papior <nickpapior@gmail.com>2020-09-17 12:29:38 +0200
committerGitHub <noreply@github.com>2020-09-17 12:29:38 +0200
commit233c63a56974de22b846ac989cef1fabe45e7296 (patch)
tree1ec1cd1f4b606603fbf3035422070eb581857e7e /numpy/distutils/tests/test_system_info.py
parent60a1e10c4593736b188b38e7d7c51aefb213af6a (diff)
downloadnumpy-233c63a56974de22b846ac989cef1fabe45e7296.tar.gz
BLD: enabled negation of library choices in NPY_*_ORDER (#17219)
BLD: enabled negation of library choices in NPY_*_ORDER When users build for a particular order it may be beneficial to disallow certain libraries. In particular a user may not care about which accelerated BLAS library is used, so long as the NetLIB or ATLAS library isn't used. This is now possible with: NPY_BLAS_ORDER='^blas,atlas' or NPY_BLAS_ORDER='!blas,atlas' Since we may envision more BLAS/LAPACK libraries to the pool, this will provide greater flexibility as they enter. A new (local) method is added in system_info.py which removes duplicate code and allows for easier usage across libraries.
Diffstat (limited to 'numpy/distutils/tests/test_system_info.py')
-rw-r--r--numpy/distutils/tests/test_system_info.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py
index 0768ffdde..46ad9b103 100644
--- a/numpy/distutils/tests/test_system_info.py
+++ b/numpy/distutils/tests/test_system_info.py
@@ -285,3 +285,30 @@ class TestSystemInfoReading:
finally:
os.chdir(previousDir)
+
+def test_distutils_parse_env_order(monkeypatch):
+ from numpy.distutils.system_info import _parse_env_order
+ env = 'NPY_TESTS_DISTUTILS_PARSE_ENV_ORDER'
+
+ base_order = list('abcdef')
+
+ monkeypatch.setenv(env, 'b,i,e,f')
+ order, unknown = _parse_env_order(base_order, env)
+ assert len(order) == 3
+ assert order == list('bef')
+ assert len(unknown) == 1
+
+ for prefix in '^!':
+ monkeypatch.setenv(env, f'{prefix}b,i,e')
+ order, unknown = _parse_env_order(base_order, env)
+ assert len(order) == 4
+ assert order == list('acdf')
+ assert len(unknown) == 1
+
+ with pytest.raises(ValueError):
+ monkeypatch.setenv(env, 'b,^e,i')
+ _parse_env_order(base_order, env)
+
+ with pytest.raises(ValueError):
+ monkeypatch.setenv(env, '!b,^e,i')
+ _parse_env_order(base_order, env)