Pytest CMake
This project provides convenient ways to use Pytest within a CMake project. The package can be discovered from a specific range of versions on Linux, macOS or Windows using the find_package function:
find_package(Pytest 8.2.1 REQUIRED)
A pytest_discover_tests function is provided to simplify automatic
testing for C++ projects with Python bindings. It can create CTest tests
for each Python test collected within a controlled environment:
pytest_discover_tests(
PythonTest
LIBRARY_PATH_PREPEND
$<TARGET_FILE_DIR:MyLibrary>
PYTHON_PATH_PREPEND
$<TARGET_FILE_DIR:MyLibrary>
TRIM_FROM_NAME "^test_"
DEPENDS MyLibrary
)
Running the tests will display the status for each test collected as follows:
Start 1: PythonTest.greet_world
1/4 Test #1: PythonTest.greet_world ........... Passed 0.47 sec
Start 2: PythonTest.greet_john
2/4 Test #2: PythonTest.greet_john ............ Passed 0.47 sec
Start 3: PythonTest.greet_julia
3/4 Test #3: PythonTest.greet_julia ........... Passed 0.47 sec
Start 4: PythonTest.greet_michael
4/4 Test #4: PythonTest.greet_michael ......... Passed 0.54 sec
Documentation
Full documentation, including installation and setup guides, can be found at https://python-cmake.github.io/pytest-cmake/
Release files for pytest-cmake 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_cmake-1.4.1.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_cmake-1.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.5 kB
Release files / pytest_cmake-1.4.1.tar.gz
| Download URL | pytest_cmake-1.4.1.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb38d6a1016d6f8dfbfadf25607352a38ed430ad32179bc85e2a7bd782febb46
|
|
BLAKE2b-256 checksum How to use checksums |
df1ecc9b944b7a97a5450b593c972bc0e8ceb4868e8a97e170635826e0f60c46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency logRelease files / pytest_cmake-1.4.1-py3-none-any.whl
| Download URL | pytest_cmake-1.4.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4a07a57fcc0f8f0899a52352a631fc3708678410309d62f679443bd24fba5c6
|
|
BLAKE2b-256 checksum How to use checksums |
2a4442f35748396e6093bbddc65e423cc9836a1c2516dd3711ae55ca07d5dc7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency log