Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pytest_cppcheck/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def pytest_addoption(parser):


def pytest_configure(config):
config.addinivalue_line("markers", "cppcheck: cppcheck static analysis test")
if not config.getoption("cppcheck"):
return
cache = getattr(config, "cache", None)
Expand Down Expand Up @@ -60,7 +61,9 @@ class CppcheckError(Exception):

class CppcheckFile(pytest.File):
def collect(self):
yield CppcheckItem.from_parent(self, name="CPPCHECK")
item = CppcheckItem.from_parent(self, name="CPPCHECK")
item.add_marker(pytest.mark.cppcheck)
yield item
Comment on lines +64 to +66
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New behavior adds a cppcheck marker so users can filter with -m cppcheck, but there’s no test asserting that marker-based selection works (e.g., pytest --cppcheck -m cppcheck runs the item, and pytest --cppcheck -m 'not cppcheck' deselects it). Please add a pytester test to cover the marker filtering to prevent regressions.

Copilot uses AI. Check for mistakes.


class CppcheckItem(pytest.Item):
Expand Down
Loading