PseudoSnake is a tool for identifying pseudo-tested statements and methods in Python packages. A pseudo-tested statement is one that is executed by a test suite but whose removal or mutation does not cause any test to fail — meaning the tests provide no real behavioral coverage for that code.
- Analyze Python packages from PyPI or local paths for pseudo-tested code
- Report methods and statements that are covered but not meaningfully tested
- Integrates with mutation testing via
cosmic-ray - Rich terminal output for clear reporting
pip install pseudosnakeOr with uv:
uv tool install pseudosnakepseudosnake --project-dir path-to-project --source-dir source-dir-name --test-command "uv run pytest" --num-test-runs 1This project uses uv for dependency management.
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and set up the project
git clone https://github.com/hemanialaparthi/pseudosnake
cd pseudosnake
uv sync --dev
# Run the tool
uv run pseudosnake --helpTo test your local changes on another project, install pseudosnake in editable mode as a uv tool:
uv tool uninstall pseudosnake
uv tool install -e .Then run it from the target project directory:
pseudosnake --project-dir . \
--source-dir <package-name> \
--test-command "pytest" \
--num-test-runs 1Note:
--source-dirshould be the package directory name (e.g.,gatorfor a project whose source lives ingator/), not necessarilysrc. Important: Before running PseudoSnake, first verify that the target project's test suite runs successfully on its own. If the tests fail independently, PseudoSnake will report a baseline error.
# Run all checks and tests
uv run task all
# Run linting
uv run task lint
# Run type checking
uv run task typecheck
# Run tests
uv run task test
# Run tests with coverage
uv run task test-coverage
# Run mutation testing
uv run task cosmic-ray-init
uv run task cosmic-ray-baseline
uv run task cosmic-ray-exec
uv run task cosmic-ray-reportMIT