Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c7a5a76

Browse files
committed
Issue #15184: Some config variables in test_sysconfig_module
may differ between sysconfig and distutils.sysconfig due to compiler customizations on OS X. For now, move those vars into a separate test and skip if the customization has taken place in distutils. The long-term solution is to eliminate having two sysconfig modules.
1 parent 2c80e12 commit c7a5a76

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

Lib/distutils/tests/test_sysconfig.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,27 @@ def test_sysconfig_module(self):
102102
import sysconfig as global_sysconfig
103103
self.assertEqual(global_sysconfig.get_config_var('CFLAGS'), sysconfig.get_config_var('CFLAGS'))
104104
self.assertEqual(global_sysconfig.get_config_var('LDFLAGS'), sysconfig.get_config_var('LDFLAGS'))
105-
self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),sysconfig.get_config_var('LDSHARED'))
105+
106+
@unittest.skipIf(sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'),'compiler flags customized')
107+
def test_sysconfig_compiler_vars(self):
108+
# On OS X, binary installers support extension module building on
109+
# various levels of the operating system with differing Xcode
110+
# configurations. This requires customization of some of the
111+
# compiler configuration directives to suit the environment on
112+
# the installed machine. Some of these customizations may require
113+
# running external programs and, so, are deferred until needed by
114+
# the first extension module build. With Python 3.3, only
115+
# the Distutils version of sysconfig is used for extension module
116+
# builds, which happens earlier in the Distutils tests. This may
117+
# cause the following tests to fail since no tests have caused
118+
# the global version of sysconfig to call the customization yet.
119+
# The solution for now is to simply skip this test in this case.
120+
# The longer-term solution is to only have one version of sysconfig.
121+
122+
import sysconfig as global_sysconfig
123+
if sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'):
124+
return
125+
self.assertEqual(global_sysconfig.get_config_var('LDSHARED'), sysconfig.get_config_var('LDSHARED'))
106126
self.assertEqual(global_sysconfig.get_config_var('CC'), sysconfig.get_config_var('CC'))
107127

108128

0 commit comments

Comments
 (0)