{"library":"pytest-cpp","title":"pytest-cpp","description":"pytest-cpp is a pytest plugin that allows the pytest runner to discover and execute C++ tests. It supports popular frameworks like Google Test, Boost.Test, and Catch2. This integration enables running tests from multi-language projects with a single command, facilitates parallel execution with plugins like pytest-xdist, and provides uniform JUnit XML output. The current version is 2.6.0, with releases typically occurring 1-3 times per year, categorizing its release cadence as 'Slow'.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pytest-cpp"],"cli":{"name":"pytest","version":"pytest 9.0.3"}},"imports":["pytest automatically discovers and loads the plugin once installed."],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"/* C++ test file: my_cpp_tests.cpp (using Google Test) */\n#include <gtest/gtest.h>\n\nTEST(ExampleTest, Succeeds) {\n    ASSERT_EQ(1, 1);\n}\n\nTEST(ExampleTest, Fails) {\n    ASSERT_EQ(1, 2); // This test will fail\n}\n\nint main(int argc, char **argv) {\n    ::testing::InitGoogleTest(&argc, argv);\n    return RUN_ALL_TESTS();\n}\n\n# Compile the C++ test (example for Linux/macOS with g++ and Google Test)\n# g++ my_cpp_tests.cpp -o test_app -I/usr/local/include -L/usr/local/lib -lgtest -lgtest_main -pthread\n# (Adjust include/lib paths as needed for your system/build setup)\n\n# To run with pytest-cpp:\n# 1. Ensure pytest-cpp is installed: pip install pytest-cpp\n# 2. Navigate to the directory containing 'test_app' executable.\n# 3. Run pytest:\n# pytest\n\n# Example pytest.ini configuration to customize C++ file discovery:\n# [pytest]\n# cpp_files = my_cpp_test_exec*\n#   cpp_arguments = -v\n\n# Expected output for the above example (truncated):\n# ============================= test session starts =============================\n# ...\n# collected 2 items\n# \n# test_app::ExampleTest.Succeeds PASSED                                  [ 50%]\n# test_app::ExampleTest.Fails FAILED                                   [100%]\n# \n# =================================== FAILURES ==================================\n# ____________________________ ExampleTest.Fails _____________________________\n# \n#     ASSERT_EQ(1, 2), failed at my_cpp_tests.cpp:10\n#     Expected: 1\n#     Actual: 2\n# \n# =========================== short test summary info ===========================\n# FAILED test_app::ExampleTest.Fails - ASSERT_EQ(1, 2), failed at my_cpp_tests.cpp:10\n# ========================= 1 failed, 1 passed in ...s =========================\n","lang":"bash","description":"After installing `pytest-cpp`, create a C++ test file (e.g., `my_cpp_tests.cpp`) using a supported framework like Google Test. Compile it into an executable (e.g., `test_app`). By default, `pytest-cpp` discovers executables matching `test_*` or `*_test` patterns. Simply run `pytest` in the directory containing your compiled C++ test executable, and `pytest-cpp` will integrate and execute these tests alongside any Python tests.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"2.6.0","pypi_latest":"2.6.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.7,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.8,"import_time_s":null,"mem_mb":null,"disk_size":"31M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"33.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.6,"import_time_s":null,"mem_mb":null,"disk_size":"34M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.3M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"26M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"26M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.1M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-cpp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.1,"import_time_s":null,"mem_mb":null,"disk_size":"31M"}]}}