diff options
author | Nick R. Papior <nickpapior@gmail.com> | 2019-04-30 23:11:41 +0200 |
---|---|---|
committer | Matti Picus <matti.picus@gmail.com> | 2019-04-30 17:11:41 -0400 |
commit | c51a56c4c78a409a884201004a1e7f605526a3a8 (patch) | |
tree | eb6280e62c96437f3e3ffb16738b6501a8415750 /numpy/distutils/tests/test_system_info.py | |
parent | 9a31efbea0a0390a59e1201a82e53f893a2f3c8c (diff) | |
download | numpy-c51a56c4c78a409a884201004a1e7f605526a3a8.tar.gz |
BLD: streamlined library names in site.cfg sections (#13157)
* BLD: use libraries as a key consistently in all site.cfg sections
Diffstat (limited to 'numpy/distutils/tests/test_system_info.py')
-rw-r--r-- | numpy/distutils/tests/test_system_info.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py index f7e275a2e..3c7638960 100644 --- a/numpy/distutils/tests/test_system_info.py +++ b/numpy/distutils/tests/test_system_info.py @@ -7,9 +7,10 @@ from tempfile import mkstemp, mkdtemp from subprocess import Popen, PIPE from distutils.errors import DistutilsError +from numpy.testing import assert_, assert_equal, assert_raises from numpy.distutils import ccompiler, customized_ccompiler -from numpy.testing import assert_, assert_equal from numpy.distutils.system_info import system_info, ConfigParser +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 @@ -22,7 +23,8 @@ def get_class(name, notfound_action=1): 2 - raise error """ cl = {'temp1': Temp1Info, - 'temp2': Temp2Info + 'temp2': Temp2Info, + 'duplicate_options': DuplicateOptionInfo, }.get(name.lower(), _system_info) return cl() @@ -43,6 +45,10 @@ library_dirs = {dir2:s} libraries = {lib2:s} extra_link_args = -Wl,-rpath={lib2_escaped:s} rpath = {dir2:s} + +[duplicate_options] +mylib_libs = {lib1:s} +libraries = {lib2:s} """ site_cfg = simple_site @@ -119,6 +125,10 @@ class Temp2Info(_system_info): """For testing purposes""" section = 'temp2' +class DuplicateOptionInfo(_system_info): + """For testing purposes""" + section = 'duplicate_options' + class TestSystemInfoReading(object): @@ -160,6 +170,9 @@ class TestSystemInfoReading(object): self.c_default = site_and_parse(get_class('default'), self._sitecfg) self.c_temp1 = site_and_parse(get_class('temp1'), self._sitecfg) self.c_temp2 = site_and_parse(get_class('temp2'), self._sitecfg) + self.c_dup_options = site_and_parse(get_class('duplicate_options'), + self._sitecfg) + def teardown(self): # Do each removal separately @@ -202,6 +215,13 @@ class TestSystemInfoReading(object): extra = tsi.calc_extra_info() assert_equal(extra['extra_link_args'], ['-Wl,-rpath=' + self._lib2]) + def test_duplicate_options(self): + # Ensure that duplicates are raising an AliasedOptionError + tsi = self.c_dup_options + assert_raises(AliasedOptionError, tsi.get_option_single, "mylib_libs", "libraries") + assert_equal(tsi.get_libs("mylib_libs", [self._lib1]), [self._lib1]) + assert_equal(tsi.get_libs("libraries", [self._lib2]), [self._lib2]) + @pytest.mark.skipif(not HAVE_COMPILER, reason="Missing compiler") def test_compile1(self): # Compile source and link the first source |