[3.13] gh-127906: Backport test_cppext changes from the main branch (#127914)

This commit is contained in:
Victor Stinner 2024-12-13 13:51:48 +01:00 committed by GitHub
parent 8384279863
commit b620e503eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -76,6 +76,8 @@ class TestCPPExt(unittest.TestCase):
cmd = [python_exe, '-X', 'dev', cmd = [python_exe, '-X', 'dev',
'-m', 'pip', 'install', '--no-build-isolation', '-m', 'pip', 'install', '--no-build-isolation',
os.path.abspath(pkg_dir)] os.path.abspath(pkg_dir)]
if support.verbose:
cmd.append('-v')
run_cmd('Install', cmd) run_cmd('Install', cmd)
# Do a reference run. Until we test that running python # Do a reference run. Until we test that running python

View file

@ -10,6 +10,7 @@ from setuptools import setup, Extension
SOURCE = 'extension.cpp' SOURCE = 'extension.cpp'
if not support.MS_WINDOWS: if not support.MS_WINDOWS:
# C++ compiler flags for GCC and clang # C++ compiler flags for GCC and clang
CPPFLAGS = [ CPPFLAGS = [
@ -19,8 +20,13 @@ if not support.MS_WINDOWS:
'-Werror', '-Werror',
] ]
else: else:
# Don't pass any compiler flag to MSVC # MSVC compiler flags
CPPFLAGS = [] CPPFLAGS = [
# Display warnings level 1 to 4
'/W4',
# Treat all compiler warnings as compiler errors
'/WX',
]
def main(): def main():