[Python-checkins] [3.12] gh-108303: Add Lib/test/test_cppext/ sub-directory (GH-108325) (#108328)
Yhg1s
webhook-mailer at python.org
Tue Aug 22 16:06:37 EDT 2023
https://github.com/python/cpython/commit/b539dd3073f9e37de25f73ad19d188cd56cc19b4
commit: b539dd3073f9e37de25f73ad19d188cd56cc19b4
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Yhg1s <thomas at python.org>
date: 2023-08-22T22:06:33+02:00
summary:
[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 21dda09600848ac280481f7c64f8d9516dc69bb2)
Co-authored-by: Victor Stinner <vstinner at python.org>
files:
A Lib/test/test_cppext/__init__.py
A Lib/test/test_cppext/extension.cpp
A Lib/test/test_cppext/setup.py
D Lib/test/_testcppext.cpp
D Lib/test/setup_testcppext.py
D Lib/test/test_cppext.py
M Makefile.pre.in
diff --git a/Lib/test/test_cppext.py b/Lib/test/test_cppext/__init__.py
similarity index 91%
rename from Lib/test/test_cppext.py
rename to Lib/test/test_cppext/__init__.py
index e2fedc9735079..f3d32a3c7612c 100644
--- a/Lib/test/test_cppext.py
+++ b/Lib/test/test_cppext/__init__.py
@@ -11,9 +11,8 @@
MS_WINDOWS = (sys.platform == 'win32')
-
-
-SETUP_TESTCPPEXT = support.findfile('setup_testcppext.py')
+SOURCE = os.path.join(os.path.dirname(__file__), 'extension.cpp')
+SETUP = os.path.join(os.path.dirname(__file__), 'setup.py')
@support.requires_subprocess()
@@ -42,7 +41,8 @@ def check_build(self, std_cpp03, extension_name):
def _check_build(self, std_cpp03, extension_name, python_exe):
pkg_dir = 'pkg'
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):
env = os.environ.copy()
diff --git a/Lib/test/_testcppext.cpp b/Lib/test/test_cppext/extension.cpp
similarity index 99%
rename from Lib/test/_testcppext.cpp
rename to Lib/test/test_cppext/extension.cpp
index 82b471312dd2b..90669b10cb2c6 100644
--- a/Lib/test/_testcppext.cpp
+++ b/Lib/test/test_cppext/extension.cpp
@@ -1,5 +1,7 @@
// 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.
+//
+// The code is only built, not executed.
// Always enable assertions
#undef NDEBUG
diff --git a/Lib/test/setup_testcppext.py b/Lib/test/test_cppext/setup.py
similarity index 93%
rename from Lib/test/setup_testcppext.py
rename to Lib/test/test_cppext/setup.py
index 22fe750085fd7..6867094a42043 100644
--- a/Lib/test/setup_testcppext.py
+++ b/Lib/test/test_cppext/setup.py
@@ -2,7 +2,6 @@
# compatible with C++ and does not emit C++ compiler warnings.
import os
import sys
-from test import support
from setuptools import setup, Extension
@@ -10,7 +9,7 @@
MS_WINDOWS = (sys.platform == 'win32')
-SOURCE = support.findfile('_testcppext.cpp')
+SOURCE = 'extension.cpp'
if not MS_WINDOWS:
# C++ compiler flags for GCC and clang
CPPFLAGS = [
diff --git a/Makefile.pre.in b/Makefile.pre.in
index d9d56bb45ce71..ae6a12c2a2c43 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2132,6 +2132,7 @@ TESTSUBDIRS= idlelib/idle_test \
test/support/_hypothesis_stubs \
test/test_asyncio \
test/test_capi \
+ test/test_cppext \
test/test_ctypes \
test/test_email \
test/test_email/data \
More information about the Python-checkins
mailing list