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.5.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.5.0
File Size Uploaded
pytest_cmake-1.5.0.tar.gz 8.3 kB Details

Built distribution (wheel)

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

Total release size: 19.2 kB

Release files / pytest_cmake-1.5.0.tar.gz

Download URL pytest_cmake-1.5.0.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
53015e8b783c31a7690274b9ea0bc146a28f7b191061f7c822c6d0a7d45b4c3c
BLAKE2b-256 checksum
How to use checksums
2621285ad699785d627faf75dd6b002e791a016326bc0d7e6d1462af34d3421b
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.5.0-py3-none-any.whl

Download URL pytest_cmake-1.5.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46a35c16f5caad2ed252d0ec71da35d4f9aa177bca54aeb5b223f6a1c9c98590
BLAKE2b-256 checksum
How to use checksums
82912ff47d46e07333de9bb075023f2970fd638a94ad7703b60723f1bdaace14
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

1.6.0

2 release files

This release

1.5.0 This release

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