2525@support .requires_subprocess ()
2626@support .requires_resource ('cpu' )
2727class BaseTests :
28+ TEST_INTERNAL_C_API = False
29+
2830 def test_build (self ):
2931 self .check_build ('_testcppext' )
3032
31- def test_build_cpp03 (self ):
32- # In public docs, we say C API is compatible with C++11. However,
33- # in practice we do maintain C++03 compatibility in public headers.
34- # Please ask the C API WG before adding a new C++11-only feature.
35- self .check_build ('_testcpp03ext' , std = 'c++03' )
36-
37- @unittest .skipIf (support .MS_WINDOWS , "MSVC doesn't support /std:c++11" )
38- def test_build_cpp11 (self ):
39- self .check_build ('_testcpp11ext' , std = 'c++11' )
40-
41- # Only test C++14 on MSVC.
42- # On s390x RHEL7, GCC 4.8.5 doesn't support C++14.
43- @unittest .skipIf (not support .MS_WINDOWS , "need Windows" )
44- def test_build_cpp14 (self ):
45- self .check_build ('_testcpp14ext' , std = 'c++14' )
46-
4733 def check_build (self , extension_name , std = None , limited = False ):
4834 venv_dir = 'env'
4935 with support .setup_venv_with_pip_setuptools (venv_dir ) as python_exe :
@@ -63,6 +49,7 @@ def run_cmd(operation, cmd):
6349 if limited :
6450 env ['CPYTHON_TEST_LIMITED' ] = '1'
6551 env ['CPYTHON_TEST_EXT_NAME' ] = extension_name
52+ env ['TEST_INTERNAL_C_API' ] = str (int (self .TEST_INTERNAL_C_API ))
6653 if support .verbose :
6754 print ('Run:' , ' ' .join (map (shlex .quote , cmd )))
6855 subprocess .run (cmd , check = True , env = env )
@@ -112,6 +99,22 @@ def test_build_limited_cpp03(self):
11299 def test_build_limited (self ):
113100 self .check_build ('_testcppext_limited' , limited = True )
114101
102+ def test_build_cpp03 (self ):
103+ # In public docs, we say C API is compatible with C++11. However,
104+ # in practice we do maintain C++03 compatibility in public headers.
105+ # Please ask the C API WG before adding a new C++11-only feature.
106+ self .check_build ('_testcpp03ext' , std = 'c++03' )
107+
108+ @unittest .skipIf (support .MS_WINDOWS , "MSVC doesn't support /std:c++11" )
109+ def test_build_cpp11 (self ):
110+ self .check_build ('_testcpp11ext' , std = 'c++11' )
111+
112+ # Only test C++14 on MSVC.
113+ # On s390x RHEL7, GCC 4.8.5 doesn't support C++14.
114+ @unittest .skipIf (not support .MS_WINDOWS , "need Windows" )
115+ def test_build_cpp14 (self ):
116+ self .check_build ('_testcpp14ext' , std = 'c++14' )
117+
115118
116119class TestInteralCAPI (BaseTests , unittest .TestCase ):
117120 TEST_INTERNAL_C_API = True
0 commit comments