summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-03-18 23:14:29 (GMT)
committerGitHub <noreply@github.com>2024-03-18 23:14:29 (GMT)
commit1d82a41235ac5619d36ac7e289fcbb686c1d9350 (patch)
tree3510df7c9f5c12c225382a10683b1f9616efa307
parentdc2d0f46540159aa22774777791105140e4d74c1 (diff)
downloadcpython-1d82a41235ac5619d36ac7e289fcbb686c1d9350.zip
cpython-1d82a41235ac5619d36ac7e289fcbb686c1d9350.tar.gz
cpython-1d82a41235ac5619d36ac7e289fcbb686c1d9350.tar.bz2
gh-116869: Enable test_cext and test_cppext on Free Threading build (#116973)
Remove the "if Py_GIL_DISABLED" skip and move all "skip" decorators to the class. Use support.check_sanitizer()
-rw-r--r--Lib/test/test_cext/__init__.py24
-rw-r--r--Lib/test/test_cppext/__init__.py27
2 files changed, 19 insertions, 32 deletions
diff --git a/Lib/test/test_cext/__init__.py b/Lib/test/test_cext/__init__.py
index 302ea3d..730b91a 100644
--- a/Lib/test/test_cext/__init__.py
+++ b/Lib/test/test_cext/__init__.py
@@ -4,7 +4,6 @@
import os.path
import shutil
import subprocess
-import sysconfig
import unittest
from test import support
@@ -13,10 +12,15 @@ SOURCE = os.path.join(os.path.dirname(__file__), 'extension.c')
SETUP = os.path.join(os.path.dirname(__file__), 'setup.py')
-# gh-110119: pip does not currently support 't' in the ABI flag use by
-# --disable-gil builds. Once it does, we can remove this skip.
-@unittest.skipIf(support.Py_GIL_DISABLED,
- 'test does not work with --disable-gil')
+# With MSVC, the linker fails with: cannot open file 'python311.lib'
+# https://github.com/python/cpython/pull/32175#issuecomment-1111175897
+@unittest.skipIf(support.MS_WINDOWS, 'test fails on Windows')
+# Building and running an extension in clang sanitizing mode is not
+# straightforward
+@support.skip_if_sanitizer('test does not work with analyzing builds',
+ address=True, memory=True, ub=True, thread=True)
+# the test uses venv+pip: skip if it's not available
+@support.requires_venv_with_pip()
@support.requires_subprocess()
@support.requires_resource('cpu')
class TestExt(unittest.TestCase):
@@ -26,16 +30,6 @@ class TestExt(unittest.TestCase):
def test_build_c11(self):
self.check_build('c11', '_test_c11_ext')
- # With MSVC, the linker fails with: cannot open file 'python311.lib'
- # https://github.com/python/cpython/pull/32175#issuecomment-1111175897
- @unittest.skipIf(support.MS_WINDOWS, 'test fails on Windows')
- # Building and running an extension in clang sanitizing mode is not
- # straightforward
- @unittest.skipIf(
- '-fsanitize' in (sysconfig.get_config_var('PY_CFLAGS') or ''),
- 'test does not work with analyzing builds')
- # the test uses venv+pip: skip if it's not available
- @support.requires_venv_with_pip()
def check_build(self, clang_std, extension_name):
venv_dir = 'env'
with support.setup_venv_with_pip_setuptools_wheel(venv_dir) as python_exe:
diff --git a/Lib/test/test_cppext/__init__.py b/Lib/test/test_cppext/__init__.py
index c6039bd..66ead9a 100644
--- a/Lib/test/test_cppext/__init__.py
+++ b/Lib/test/test_cppext/__init__.py
@@ -4,7 +4,6 @@ import os.path
import shutil
import unittest
import subprocess
-import sysconfig
from test import support
@@ -12,30 +11,24 @@ SOURCE = os.path.join(os.path.dirname(__file__), 'extension.cpp')
SETUP = os.path.join(os.path.dirname(__file__), 'setup.py')
-# gh-110119: pip does not currently support 't' in the ABI flag use by
-# --disable-gil builds. Once it does, we can remove this skip.
-@unittest.skipIf(support.Py_GIL_DISABLED,
- 'test does not work with --disable-gil')
+# With MSVC, the linker fails with: cannot open file 'python311.lib'
+# https://github.com/python/cpython/pull/32175#issuecomment-1111175897
+@unittest.skipIf(support.MS_WINDOWS, 'test fails on Windows')
+# Building and running an extension in clang sanitizing mode is not
+# straightforward
+@support.skip_if_sanitizer('test does not work with analyzing builds',
+ address=True, memory=True, ub=True, thread=True)
+# the test uses venv+pip: skip if it's not available
+@support.requires_venv_with_pip()
@support.requires_subprocess()
+@support.requires_resource('cpu')
class TestCPPExt(unittest.TestCase):
- @support.requires_resource('cpu')
def test_build_cpp11(self):
self.check_build(False, '_testcpp11ext')
- @support.requires_resource('cpu')
def test_build_cpp03(self):
self.check_build(True, '_testcpp03ext')
- # With MSVC, the linker fails with: cannot open file 'python311.lib'
- # https://github.com/python/cpython/pull/32175#issuecomment-1111175897
- @unittest.skipIf(support.MS_WINDOWS, 'test fails on Windows')
- # Building and running an extension in clang sanitizing mode is not
- # straightforward
- @unittest.skipIf(
- '-fsanitize' in (sysconfig.get_config_var('PY_CFLAGS') or ''),
- 'test does not work with analyzing builds')
- # the test uses venv+pip: skip if it's not available
- @support.requires_venv_with_pip()
def check_build(self, std_cpp03, extension_name):
venv_dir = 'env'
with support.setup_venv_with_pip_setuptools_wheel(venv_dir) as python_exe: