Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b539dd3

Browse filesBrowse files
[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 21dda09) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent ca47a21 commit b539dd3
Copy full SHA for b539dd3

File tree

4 files changed

+8
-6
lines changed
Filter options

4 files changed

+8
-6
lines changed

‎Lib/test/test_cppext.py renamed to ‎Lib/test/test_cppext/__init__.py

Copy file name to clipboardExpand all lines: Lib/test/test_cppext/__init__.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111

1212

1313
MS_WINDOWS = (sys.platform == 'win32')
14-
15-
16-
SETUP_TESTCPPEXT = support.findfile('setup_testcppext.py')
14+
SOURCE = os.path.join(os.path.dirname(__file__), 'extension.cpp')
15+
SETUP = os.path.join(os.path.dirname(__file__), 'setup.py')
1716

1817

1918
@support.requires_subprocess()
@@ -42,7 +41,8 @@ def check_build(self, std_cpp03, extension_name):
4241
def _check_build(self, std_cpp03, extension_name, python_exe):
4342
pkg_dir = 'pkg'
4443
os.mkdir(pkg_dir)
45-
shutil.copy(SETUP_TESTCPPEXT, os.path.join(pkg_dir, "setup.py"))
44+
shutil.copy(SETUP, os.path.join(pkg_dir, os.path.basename(SETUP)))
45+
shutil.copy(SOURCE, os.path.join(pkg_dir, os.path.basename(SOURCE)))
4646

4747
def run_cmd(operation, cmd):
4848
env = os.environ.copy()

‎Lib/test/_testcppext.cpp renamed to ‎Lib/test/test_cppext/extension.cpp

Copy file name to clipboardExpand all lines: Lib/test/test_cppext/extension.cpp
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// gh-91321: Very basic C++ test extension to check that the Python C API is
22
// compatible with C++ and does not emit C++ compiler warnings.
3+
//
4+
// The code is only built, not executed.
35

46
// Always enable assertions
57
#undef NDEBUG

‎Lib/test/setup_testcppext.py renamed to ‎Lib/test/test_cppext/setup.py

Copy file name to clipboardExpand all lines: Lib/test/test_cppext/setup.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
# compatible with C++ and does not emit C++ compiler warnings.
33
import os
44
import sys
5-
from test import support
65

76
from setuptools import setup, Extension
87

98

109
MS_WINDOWS = (sys.platform == 'win32')
1110

1211

13-
SOURCE = support.findfile('_testcppext.cpp')
12+
SOURCE = 'extension.cpp'
1413
if not MS_WINDOWS:
1514
# C++ compiler flags for GCC and clang
1615
CPPFLAGS = [

‎Makefile.pre.in

Copy file name to clipboardExpand all lines: Makefile.pre.in
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,6 +2132,7 @@ TESTSUBDIRS= idlelib/idle_test \
21322132
test/support/_hypothesis_stubs \
21332133
test/test_asyncio \
21342134
test/test_capi \
2135+
test/test_cppext \
21352136
test/test_ctypes \
21362137
test/test_email \
21372138
test/test_email/data \

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.