mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-108303: Add Lib/test/test_cppext/ sub-directory (#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)
This commit is contained in:
parent
12cad6155b
commit
a15396146f
4 changed files with 8 additions and 7 deletions
|
|
@ -10,9 +10,7 @@
|
||||||
|
|
||||||
|
|
||||||
MS_WINDOWS = (sys.platform == 'win32')
|
MS_WINDOWS = (sys.platform == 'win32')
|
||||||
|
SETUP = os.path.join(os.path.dirname(__file__), 'setup.py')
|
||||||
|
|
||||||
SETUP_TESTCPPEXT = support.findfile('setup_testcppext.py')
|
|
||||||
|
|
||||||
|
|
||||||
@support.requires_subprocess()
|
@support.requires_subprocess()
|
||||||
|
|
@ -74,14 +72,14 @@ def run_cmd(operation, cmd):
|
||||||
|
|
||||||
# Build the C++ extension
|
# Build the C++ extension
|
||||||
cmd = [python, '-X', 'dev',
|
cmd = [python, '-X', 'dev',
|
||||||
SETUP_TESTCPPEXT, 'build_ext', '--verbose']
|
SETUP, 'build_ext', '--verbose']
|
||||||
if std_cpp03:
|
if std_cpp03:
|
||||||
cmd.append('-std=c++03')
|
cmd.append('-std=c++03')
|
||||||
run_cmd('Build', cmd)
|
run_cmd('Build', cmd)
|
||||||
|
|
||||||
# Install the C++ extension
|
# Install the C++ extension
|
||||||
cmd = [python, '-X', 'dev',
|
cmd = [python, '-X', 'dev',
|
||||||
SETUP_TESTCPPEXT, 'install']
|
SETUP, 'install']
|
||||||
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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# gh-91321: Build a basic C++ test extension to check that the Python C API is
|
# gh-91321: Build a 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.
|
||||||
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
from test import support
|
|
||||||
|
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
MS_WINDOWS = (sys.platform == 'win32')
|
MS_WINDOWS = (sys.platform == 'win32')
|
||||||
|
|
||||||
|
|
||||||
SOURCE = support.findfile('_testcppext.cpp')
|
SOURCE = os.path.join(os.path.dirname(__file__), '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 = [
|
||||||
|
|
@ -1959,6 +1959,7 @@ TESTSUBDIRS= ctypes/test \
|
||||||
test/support \
|
test/support \
|
||||||
test/test_asyncio \
|
test/test_asyncio \
|
||||||
test/test_capi \
|
test/test_capi \
|
||||||
|
test/test_cppext \
|
||||||
test/test_email \
|
test/test_email \
|
||||||
test/test_email/data \
|
test/test_email/data \
|
||||||
test/test_import \
|
test/test_import \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue