From c51a56c4c78a409a884201004a1e7f605526a3a8 Mon Sep 17 00:00:00 2001 From: "Nick R. Papior" Date: Tue, 30 Apr 2019 23:11:41 +0200 Subject: BLD: streamlined library names in site.cfg sections (#13157) * BLD: use libraries as a key consistently in all site.cfg sections --- numpy/distutils/tests/test_system_info.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'numpy/distutils/tests/test_system_info.py') 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 -- cgit v1.2.1