[Python-checkins] bpo-11191: skip unsupported test_distutils case for AIX with xlc (GH-8709)

Nick Coghlan webhook-mailer at python.org
Fri Dec 28 09:03:24 EST 2018


https://github.com/python/cpython/commit/ed57e13df60ce28ba89bd49c9c5a15b1d9bf79c7
commit: ed57e13df60ce28ba89bd49c9c5a15b1d9bf79c7
branch: master
author: Michael Felt <aixtools at users.noreply.github.com>
committer: Nick Coghlan <ncoghlan at gmail.com>
date: 2018-12-29T00:03:17+10:00
summary:

bpo-11191: skip unsupported test_distutils case for AIX with xlc (GH-8709)

Command line options for the xlc compiler behave differently from gcc and clang,
so skip this test case for now when xlc is the compiler.

Patch by aixtools (Michael Felt)

files:
A Misc/NEWS.d/next/Tests/2018-08-08-22-41-30.bpo-11191.eq9tSH.rst
M Lib/distutils/command/config.py
M Lib/distutils/tests/test_config_cmd.py

diff --git a/Lib/distutils/command/config.py b/Lib/distutils/command/config.py
index f511b8885770..aeda408e7319 100644
--- a/Lib/distutils/command/config.py
+++ b/Lib/distutils/command/config.py
@@ -328,7 +328,6 @@ def check_header(self, header, include_dirs=None, library_dirs=None,
         return self.try_cpp(body="/* No body */", headers=[header],
                             include_dirs=include_dirs)
 
-
 def dump_file(filename, head=None):
     """Dumps a file content into log.info.
 
diff --git a/Lib/distutils/tests/test_config_cmd.py b/Lib/distutils/tests/test_config_cmd.py
index 6e566e79152a..b735fd334d87 100644
--- a/Lib/distutils/tests/test_config_cmd.py
+++ b/Lib/distutils/tests/test_config_cmd.py
@@ -39,11 +39,17 @@ def test_dump_file(self):
 
     @unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
     def test_search_cpp(self):
+        import shutil
         cmd = missing_compiler_executable(['preprocessor'])
         if cmd is not None:
             self.skipTest('The %r command is not found' % cmd)
         pkg_dir, dist = self.create_dist()
         cmd = config(dist)
+        cmd._check_compiler()
+        compiler = cmd.compiler
+        is_xlc = shutil.which(compiler.preprocessor[0]).startswith("/usr/vac")
+        if is_xlc:
+            self.skipTest('xlc: The -E option overrides the -P, -o, and -qsyntaxonly options')
 
         # simple pattern searches
         match = cmd.search_cpp(pattern='xxx', body='/* xxx */')
diff --git a/Misc/NEWS.d/next/Tests/2018-08-08-22-41-30.bpo-11191.eq9tSH.rst b/Misc/NEWS.d/next/Tests/2018-08-08-22-41-30.bpo-11191.eq9tSH.rst
new file mode 100644
index 000000000000..d05d52238e07
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2018-08-08-22-41-30.bpo-11191.eq9tSH.rst
@@ -0,0 +1,2 @@
+Skip the distutils test 'test_search_cpp' when using XLC as compiler
+patch by aixtools (Michael Felt)



More information about the Python-checkins mailing list