8000 [3.12] gh-108303: Add Lib/test/test_cppext/ sub-directory (GH-108325) by miss-islington · Pull Request #108328 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.12] gh-108303: Add Lib/test/test_cppext/ sub-directory (GH-108325) #108328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
  • Loading branch information
vstinner authored and miss-islington committed Aug 22, 2023
commit d71662500f6d51ab1393daff599f3a23fac1fb7f
8 changes: 4 additions & 4 deletions Lib/test/test_cppext.py → Lib/test/test_cppext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
# compatible with C++ and does not emit C++ compiler warnings.
import os
import sys
from test import support

from setuptools import setup, Extension


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 = [
Expand Down
1 change: 1 addition & 0 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
0