Skip to main content

pytest-cpplint

CI PyPI Python License

A pytest plugin that runs cpplint style checking on C/C++ source files. Each file is collected as a test item and reported as a pass or failure in the normal pytest output.

Useful for Python projects with C extension modules where you already run pytest and want cpplint findings surfaced in the same test run.

Installation

pip install pytest-cpplint

This pulls in cpplint automatically via the cpplint PyPI package.

Usage

The plugin does nothing unless explicitly enabled:

pytest --cpplint

This collects all .c, .cc, .cpp, .cxx, .h, .hpp, and .hxx files and runs cpplint on each one. Files with findings fail; clean files pass.

PASSED src/clean.c::CPPLINT
FAILED src/buggy.c::CPPLINT
  src/buggy.c:12:  Lines should be <= 80 characters long  [whitespace/line_length] [2]

You can combine --cpplint with your normal test run — Python tests and cpplint items appear together in the results.

Configuration

All options go in pyproject.toml, pytest.ini, or setup.cfg under [pytest].

cpplint_args

Extra arguments forwarded to every cpplint invocation. This is the main configuration surface — use it for --filter, --linelength, --root, and any other cpplint flags.

With no cpplint_args, cpplint runs all of its default checks (Google C++ style guide). Use --filter to enable or disable specific categories. A good starting configuration:

[pytest]
cpplint_args =
    --linelength=120
    --filter=-legal/copyright,-build/header_guard

cpplint_extensions

File extensions to collect. Default: .c .cc .cpp .cxx .h .hpp .hxx.

[pytest]
cpplint_extensions = .c .cpp .h

Markers

All cpplint items are marked with cpplint, so you can select or exclude them with -m:

pytest --cpplint -m cpplint           # only cpplint
pytest --cpplint -m "unit or cpplint" # unit tests + cpplint
pytest --cpplint -m "not cpplint"     # everything except cpplint

Caching

Results are cached based on file modification time and cpplint_args. On subsequent runs, files that previously passed are skipped. The cache is automatically invalidated when a file is modified or cpplint_args changes. Caching relies on pytest's built-in cache provider (the .pytest_cache directory). If the cache provider is disabled (for example with -p no:cacheprovider), results will not be cached and all files will be re-checked on each run.

To force a full re-check:

pytest --cpplint --cache-clear

License

MIT

Release files for pytest-cpplint 0.1.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-cpplint 0.1.0
File Size Uploaded
pytest_cpplint-0.1.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-cpplint 0.1.0
File Interpreter ABI Platform
pytest_cpplint-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.7 kB

Release files / pytest_cpplint-0.1.0.tar.gz

Download URL pytest_cpplint-0.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
53b7cd8a2cf2e71cc1f5ef04e04912bab1cb5d0a8367d41dfe6b08ed98a36949
BLAKE2b-256 checksum
How to use checksums
88058da3643fe1c4e9cc103ac5739638fa9845cd0e0a2b74353582b420877ba5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 26, 2026.

Transparency log

Release files / pytest_cpplint-0.1.0-py3-none-any.whl

Download URL pytest_cpplint-0.1.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93a5342ca1fb95a059fee6e286798465533c9f2111cc0b1dc8182f723371aa68
BLAKE2b-256 checksum
How to use checksums
9640f40ce41e0a194a2b44b23391c2c3ac0cd79ca67bac687e4b9c8e27f89b0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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