mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
gh-127906: Test the limited C API in test_cppext (#127916)
This commit is contained in:
parent
6ff38fc4e2
commit
d05a4e6a0d
4 changed files with 26 additions and 3 deletions
|
|
@ -41,12 +41,17 @@ def test_build_cpp11(self):
|
|||
def test_build_cpp14(self):
|
||||
self.check_build('_testcpp14ext', std='c++14')
|
||||
|
||||
def check_build(self, extension_name, std=None):
|
||||
@support.requires_gil_enabled('incompatible with Free Threading')
|
||||
def test_build_limited(self):
|
||||
self.check_build('_testcppext_limited', limited=True)
|
||||
|
||||
def check_build(self, extension_name, std=None, limited=False):
|
||||
venv_dir = 'env'
|
||||
with support.setup_venv_with_pip_setuptools_wheel(venv_dir) as python_exe:
|
||||
self._check_build(extension_name, python_exe, std=std)
|
||||
self._check_build(extension_name, python_exe,
|
||||
std=std, limited=limited)
|
||||
|
||||
def _check_build(self, extension_name, python_exe, std):
|
||||
def _check_build(self, extension_name, python_exe, std, limited):
|
||||
pkg_dir = 'pkg'
|
||||
os.mkdir(pkg_dir)
|
||||
shutil.copy(SETUP, os.path.join(pkg_dir, os.path.basename(SETUP)))
|
||||
|
|
@ -56,6 +61,8 @@ def run_cmd(operation, cmd):
|
|||
env = os.environ.copy()
|
||||
if std:
|
||||
env['CPYTHON_TEST_CPP_STD'] = std
|
||||
if limited:
|
||||
env['CPYTHON_TEST_LIMITED'] = '1'
|
||||
env['CPYTHON_TEST_EXT_NAME'] = extension_name
|
||||
if support.verbose:
|
||||
print('Run:', ' '.join(map(shlex.quote, cmd)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue