mirror of
https://github.com/python/cpython.git
synced 2025-08-16 14:50:43 +00:00
[3.12] gh-108303: Add Lib/test/test_cppext/ sub-directory (GH-108325) (#108328)
gh-108303: Add Lib/test/test_cppext/ sub-directory (GH-108325)
* Move test_cppext to its own directory
* Rename setup_testcppext.py to setup.py
* Rename _testcppext.cpp to extension.cpp
* The source (extension.cpp) is now also copied by the test.
(cherry picked from commit 21dda09600
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
ca47a2183a
commit
b539dd3073
4 changed files with 8 additions and 6 deletions
|
@ -11,9 +11,8 @@ from test.support import os_helper
|
||||||
|
|
||||||
|
|
||||||
MS_WINDOWS = (sys.platform == 'win32')
|
MS_WINDOWS = (sys.platform == 'win32')
|
||||||
|
SOURCE = os.path.join(os.path.dirname(__file__), 'extension.cpp')
|
||||||
|
SETUP = os.path.join(os.path.dirname(__file__), 'setup.py')
|
||||||
SETUP_TESTCPPEXT = support.findfile('setup_testcppext.py')
|
|
||||||
|
|
||||||
|
|
||||||
@support.requires_subprocess()
|
@support.requires_subprocess()
|
||||||
|
@ -42,7 +41,8 @@ class TestCPPExt(unittest.TestCase):
|
||||||
def _check_build(self, std_cpp03, extension_name, python_exe):
|
def _check_build(self, std_cpp03, extension_name, python_exe):
|
||||||
pkg_dir = 'pkg'
|
pkg_dir = 'pkg'
|
||||||
os.mkdir(pkg_dir)
|
os.mkdir(pkg_dir)
|
||||||
shutil.copy(SETUP_TESTCPPEXT, os.path.join(pkg_dir, "setup.py"))
|
shutil.copy(SETUP, os.path.join(pkg_dir, os.path.basename(SETUP)))
|
||||||
|
shutil.copy(SOURCE, os.path.join(pkg_dir, os.path.basename(SOURCE)))
|
||||||
|
|
||||||
def run_cmd(operation, cmd):
|
def run_cmd(operation, cmd):
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
|
@ -1,5 +1,7 @@
|
||||||
// gh-91321: Very basic C++ test extension to check that the Python C API is
|
// gh-91321: Very basic C++ test extension to check that the Python C API is
|
||||||
// compatible with C++ and does not emit C++ compiler warnings.
|
// compatible with C++ and does not emit C++ compiler warnings.
|
||||||
|
//
|
||||||
|
// The code is only built, not executed.
|
||||||
|
|
||||||
// Always enable assertions
|
// Always enable assertions
|
||||||
#undef NDEBUG
|
#undef NDEBUG
|
|
@ -2,7 +2,6 @@
|
||||||
# compatible with C++ and does not emit C++ compiler warnings.
|
# compatible with C++ and does not emit C++ compiler warnings.
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from test import support
|
|
||||||
|
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
|
|
||||||
|
@ -10,7 +9,7 @@ from setuptools import setup, Extension
|
||||||
MS_WINDOWS = (sys.platform == 'win32')
|
MS_WINDOWS = (sys.platform == 'win32')
|
||||||
|
|
||||||
|
|
||||||
SOURCE = support.findfile('_testcppext.cpp')
|
SOURCE = 'extension.cpp'
|
||||||
if not MS_WINDOWS:
|
if not MS_WINDOWS:
|
||||||
# C++ compiler flags for GCC and clang
|
# C++ compiler flags for GCC and clang
|
||||||
CPPFLAGS = [
|
CPPFLAGS = [
|
|
@ -2132,6 +2132,7 @@ TESTSUBDIRS= idlelib/idle_test \
|
||||||
test/support/_hypothesis_stubs \
|
test/support/_hypothesis_stubs \
|
||||||
test/test_asyncio \
|
test/test_asyncio \
|
||||||
test/test_capi \
|
test/test_capi \
|
||||||
|
test/test_cppext \
|
||||||
test/test_ctypes \
|
test/test_ctypes \
|
||||||
test/test_email \
|
test/test_email \
|
||||||
test/test_email/data \
|
test/test_email/data \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue