diff options
author | mattip <matti.picus@gmail.com> | 2020-01-17 07:53:17 +1100 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2020-01-20 08:39:54 +1100 |
commit | 7471b5610e9cba0ecb73b6ea96bd132359530645 (patch) | |
tree | 625aceaba52bd4fea7e9db50da6e5d2c2452f026 /numpy/distutils/tests | |
parent | 57e20038e4efac1a7b4828881c3f8fe6438b3c11 (diff) | |
download | numpy-7471b5610e9cba0ecb73b6ea96bd132359530645.tar.gz |
DOC: link and cleanup docstrings in site.cfg.example
Diffstat (limited to 'numpy/distutils/tests')
-rw-r--r-- | numpy/distutils/tests/test_system_info.py | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py index c40cdb7db..0768ffdde 100644 --- a/numpy/distutils/tests/test_system_info.py +++ b/numpy/distutils/tests/test_system_info.py @@ -7,7 +7,7 @@ from distutils.errors import DistutilsError from numpy.testing import assert_, assert_equal, assert_raises from numpy.distutils import ccompiler, customized_ccompiler -from numpy.distutils.system_info import system_info, ConfigParser +from numpy.distutils.system_info import system_info, ConfigParser, mkl_info from numpy.distutils.system_info import AliasedOptionError from numpy.distutils.system_info import default_lib_dirs, default_include_dirs from numpy.distutils import _shell_utils @@ -253,3 +253,35 @@ class TestSystemInfoReading: assert_(os.path.isfile(self._src2.replace('.c', '.o'))) finally: os.chdir(previousDir) + + def test_overrides(self): + previousDir = os.getcwd() + cfg = os.path.join(self._dir1, 'site.cfg') + shutil.copy(self._sitecfg, cfg) + try: + os.chdir(self._dir1) + # Check that the '[ALL]' section does not override + # missing values from other sections + info = mkl_info() + lib_dirs = info.cp['ALL']['library_dirs'].split(os.pathsep) + assert info.get_lib_dirs() != lib_dirs + + # But if we copy the values to a '[mkl]' section the value + # is correct + with open(cfg, 'r') as fid: + mkl = fid.read().replace('ALL', 'mkl') + with open(cfg, 'w') as fid: + fid.write(mkl) + info = mkl_info() + assert info.get_lib_dirs() == lib_dirs + + # Also, the values will be taken from a section named '[DEFAULT]' + with open(cfg, 'r') as fid: + dflt = fid.read().replace('mkl', 'DEFAULT') + with open(cfg, 'w') as fid: + fid.write(dflt) + info = mkl_info() + assert info.get_lib_dirs() == lib_dirs + finally: + os.chdir(previousDir) + |