Skip to main content

Pytest CMake

PyPi version CMake Test License

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

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-cmake 1.6.0
File Size Uploaded
pytest_cmake-1.6.0.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-cmake 1.6.0
File Interpreter ABI Platform
pytest_cmake-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / pytest_cmake-1.6.0.tar.gz

Download URL pytest_cmake-1.6.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
77ccf8bbb913b615ea9e198551019d6e07c3195e411b610e06a922e72cd0dcbb
BLAKE2b-256 checksum
How to use checksums
c538bf9e27bdf56ce4f9a8800e2771107a3381267d7e7ab2aecd5b931fc2de49
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 20, 2026.

Transparency log

Release files / pytest_cmake-1.6.0-py3-none-any.whl

Download URL pytest_cmake-1.6.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4d5de1775965b190b5c87afe326bfc77eb0c59551c7327ba03d169e6b6c39a3
BLAKE2b-256 checksum
How to use checksums
12fe164bedd314071b904f241739a1feeac4ae9056a4bc80867dae85ee410885
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 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.3.0

2 release files

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.13.0

1 release file

0.12.0

1 release file

0.11.4

1 release file

0.11.3

1 release file

0.11.2

1 release file

0.11.1

1 release file

0.11.0

1 release file

0.10.0

1 release file

0.9.0

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.1.0

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page