Crates.io | collect-unmarked-tests |
lib.rs | collect-unmarked-tests |
version | 0.1.0 |
created_at | 2025-09-25 15:14:13.231776+00 |
updated_at | 2025-09-25 15:14:13.231776+00 |
description | A fast Rust tool to collect Python tests that don't have specific pytest markers |
homepage | https://github.com/stancld/collect-unmarked-tests |
repository | https://github.com/stancld/collect-unmarked-tests |
max_upload_size | |
id | 1854748 |
size | 29,459 |
A fast Rust tool to collect Python tests that don't have specific pytest markers.
# Scan default 'tests' directory
cargo run
# Scan specific directory
cargo run -- src
# Exclude specific markers
cargo run -- --exclude-markers unit,integration,component,slow tests
Prerequisites:
Debug build:
cargo build
./target/debug/collect-unmarked-tests --help
Release build:
cargo build --release
./target/release/collect-unmarked-tests --help
Install locally (optional):
cargo install --path .
collect-unmarked-tests --help
The last command is equivalent to:
pytest -m 'not unit and not integration and not component and not slow' tests
unit
integration
component
skip
slow
The tool scans Python files for test_*
functions and excludes those with
pytest markers like @pytest.mark.unit
or @skip
.
Add this to your .pre-commit-config.yaml
:
repos:
- repo: https://github.com/stancld/collect-unmarked-tests
rev: v0.1.0 # Use a specific version tag
hooks:
- id: collect-unmarked-tests
args: ['--exclude-markers', 'unit,integration,component,slow']
To scan only specific directories/packages:
repos:
- repo: https://github.com/stancld/collect-unmarked-tests
rev: v0.1.0
hooks:
- id: collect-unmarked-tests
args: ['src/mypackage', 'tests/unit']
Or use a local installation:
repos:
- repo: local
hooks:
- id: collect-unmarked-tests
name: Check for unmarked pytest tests
entry: collect-unmarked-tests
language: system
files: '\.py$'
args: ['tests']
pass_filenames: false