Skip to content
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

test_cppext does not import/run the C++ extension #94751

Open
encukou opened this issue Jul 11, 2022 · 2 comments
Open

test_cppext does not import/run the C++ extension #94751

encukou opened this issue Jul 11, 2022 · 2 comments
Labels
tests Tests in the Lib/test dir

Comments

@encukou
Copy link
Member

encukou commented Jul 11, 2022

The test_cppext test case only checks that the C++ extension builds. It does not import and run test cases, so it can't catch runtime issues like #94731.

@encukou encukou added the tests Tests in the Lib/test dir label Jul 11, 2022
encukou added a commit that referenced this issue Jul 12, 2022
)

This is a quick-and-dirty way to run the C++ tests.
It can definitely be improved in the future, but it should fail when things go wrong.

- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension installable
- Install and import the extension in test_cppext
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 12, 2022
…ythonGH-94754)

This is a quick-and-dirty way to run the C++ tests.
It can definitely be improved in the future, but it should fail when things go wrong.

- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension installable
- Install and import the extension in test_cppext
(cherry picked from commit ec5db53)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
@encukou
Copy link
Member Author

encukou commented Jul 12, 2022

Merged the MVP, but there's still work to do:

  • running setup.py is deprecated, we should probably build/install using pip
  • the tests could be run individually, so the first failure doesn't mask others

encukou added a commit that referenced this issue Jul 13, 2022
) (#94780)

This is a quick-and-dirty way to run the C++ tests.
It can definitely be improved in the future, but it should fail when things go wrong.

- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension installable
- Install and import the extension in test_cppext
(cherry picked from commit ec5db53)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
@vstinner
Copy link
Member

vstinner commented Aug 3, 2022

The test_cppext test case only checks that the C++ extension builds

Right, for now it's its only purpose as written at top of Lib/test/_testcppext.cpp:

// 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.

And Lib/test/test_cppext.py:

# 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.

The reason is that I was too lazy to finish the work to actually import the built extension. I got enough C++ issues to handle. By the way, it seems like most of the work to fix C++ warnings has been reverted by commit 6cbb57f.

I also got busy with replacing distutils with setuptools (using venv).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

No branches or pull requests

2 participants