pytest-integrity

Validate pytest collection and execution counts to prevent silent test deselection.

Updated Oct 9, 2025
One-click install
npx skills add https://github.com/Siamese001/Agentic-Workflow --skill pytest-integrity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytest-integrity
Source: https://github.com/Siamese001/Agentic-Workflow/tree/main/.windsurf/skills/pytest-integrity
Command: npx skills add https://github.com/Siamese001/Agentic-Workflow --skill pytest-integrity

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents silent test deselection in pytest, ensuring that all intended tests are collected and executed, thereby guaranteeing the integrity of your test suite.

Core Features & Use Cases

  • Collection vs. Execution Verification: Compares the number of tests collected by pytest with the number actually executed, flagging any discrepancies.
  • Conftest Hook Auditing: Inspects conftest.py files for pytest_collection_modifyitems hooks that might be filtering tests, ensuring proper marker registration and hook logic.
  • Use Case: When running automated tests as part of a CI/CD pipeline, this Skill ensures that no tests are silently dropped, providing confidence that the entire test suite is being run.

Quick Start

Run the pytest integrity skill to verify that all collected pytest tests are executed.

Frequently Asked Questions about pytest-integrity

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent silent test deselection in pytest?

Preventing silent test deselection in pytest requires comparing collected test counts against executed counts to flag discrepancies. Auditing conftest.py hooks for marker filtering logic ensures all intended tests run during collection and execution.

Why does pytest collect fewer tests than expected during CI/CD automation?

Pytest collects fewer tests than expected during CI/CD automation when conftest.py hooks silently filter items. Auditing pytest_collection_modifyitems hooks and verifying marker registration in pytest.ini identifies the filtering logic causing the discrepancy.

How to audit conftest hooks for marker filtering logic in pytest?

Auditing conftest hooks for marker filtering logic involves inspecting pytest_collection_modifyitems implementations in conftest.py. This verifies proper marker registration in pytest.ini and ensures deterministic test execution for phase acceptance criteria.

Does pytest collection count always match the execution count?

The pytest collection count does not always match the execution count due to silent deselection. Validating collection versus execution counts detects discrepancies and guarantees the integrity of the automated test suite.

How do I verify marker registration in pytest.ini for deterministic test execution?

Verifying marker registration in pytest.ini for deterministic test execution requires auditing conftest.py hooks. Inspecting pytest_collection_modifyitems ensures markers are properly registered and prevents unintended test filtering.