diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2020-01-31 08:39:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-31 08:39:45 -0700 |
commit | 71802423b3ab7463bb6213cc15a7a07464b4a31b (patch) | |
tree | f5724ff4b07dc8a103b064f0ae1c93887af43268 /numpy/distutils/tests | |
parent | 63cf59bd937004816bb7f991e022f5a89af4c188 (diff) | |
parent | 6472a7d4eee9d9997773177b08e30c9c4326fbeb (diff) | |
download | numpy-71802423b3ab7463bb6213cc15a7a07464b4a31b.tar.gz |
Merge pull request #15338 from mattip/site.cfg
DOC: document 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) + |