pytest-cmake
Provide CMake module for Pytest
Decision gist · record as of 2026-08-14
Yes, if you maintain a CMake project with Python tests or C++ code with Python bindings. The package has low install friction, permissive licensing, and no known vulnerabilities. The aging maintenance status is a minor concern for a stable, narrowly-scoped integration tool, but the repository remains active and supports current Python versions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires CMake and pytest to be installed; pytest-cmake is a CMake module, not a standalone Python tool
- Low friction install with a single runtime dependency on pytest.
- Last release was 223 days ago; repository is active but aging.
License · maintenance · safety
permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.
last release 2026-01-03 (223 days) · last repo commit 2026-01-03 · 32 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 269,703 downloads/mo, #8,252 on PyPI
Alternatives
Verify before relying
pip install pytest-cmake
In CMakeLists.txt:
find_package(Pytest 8.2.1 REQUIRED)
pytest_discover_tests(PythonTest LIBRARY_PATH_PREPEND $<TARGET_FILE_DIR:MyLibrary>)- Whether the package works with pytest versions outside the range shown in the description example (8.2.1)
- Performance characteristics when discovering large numbers of Python tests in a single CMake project
What it is and what it does
pytest-cmake is a CMake module that bridges Pytest and CMake, allowing Python tests to be discovered and run as part of a C++ project's build system. It provides a find_package function to locate Pytest and a pytest_discover_tests function that automatically converts Python tests into CTest entries, which can then be executed and reported alongside native C++ tests.
The package is designed for mixed-language projects—particularly those with C++ libraries that expose Python bindings. Instead of running Python tests separately, developers can integrate them into their CMake workflow, controlling test environment variables like library and Python paths, filtering test names, and declaring dependencies on compiled targets.
Use it for
- Integrate Python unit tests for C++ extension modules into a unified CMake test suite
- Automatically discover and register Python tests as CTest entries without manual configuration
- Set up controlled test environments by prepending library and Python paths before test execution
- Run mixed C++ and Python tests in a single CI/CD pipeline using ctest
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you maintain a CMake project with Python tests or C++ code with Python bindings.
The package has low install friction, permissive licensing, and no known vulnerabilities. The aging maintenance status is a minor concern for a stable, narrowly-scoped integration tool, but the repository remains active and supports current Python versions.
Install
pytest-cmake on PyPI
Before you install
Low friction install with a single runtime dependency on pytest. Last release was 223 days ago; repository is active but aging.
Requires CMake and pytest to be installed; pytest-cmake is a CMake module, not a standalone Python tool
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.
Quickstart
pip install pytest-cmake
In CMakeLists.txt:
find_package(Pytest 8.2.1 REQUIRED)
pytest_discover_tests(PythonTest LIBRARY_PATH_PREPEND $<TARGET_FILE_DIR:MyLibrary>)
Verify before relying
- Whether the package works with pytest versions outside the range shown in the description example (8.2.1)
- Performance characteristics when discovering large numbers of Python tests in a single CMake project
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release <4,>=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Aging 223 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 269,703 / month, #8,252 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Build Tools |
Evidence: pytest_cmake-1.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “cmake pytest integration”
- pytest-cmakeIntegrates Pytest with CMake build systems, enabling automatic…
- colcon-cmakecolcon-cmake is a plugin for colcon that adds support for building…
- scikit-buildscikit-build bridges setuptools and CMake to compile CPython…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also cmake · google-benchmark · fckitlib · cmakelang · colcon-cmake · scikit-build-core · cmake-format · scikit-build · pytest-mypy · cmakelint