Skip to content
Development
Command

/test

Run Python tests with pytest, unittest, or other testing frameworks.

From plugin
claude-code-templates
31k200 skills200 agents200 commands32 MCP
Install
$ npx -y skills add davila7/claude-code-templates --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/test

Context preview

What this command does when you run it.

Run Python tests with pytest, unittest, or other testing frameworks.

Command definition

test.md

Test Runner

Run Python tests with pytest, unittest, or other testing frameworks.

Purpose

This command helps you run Python tests effectively with proper configuration and reporting.

Usage

/test

What this command does

1. **Detects test framework** (pytest, unittest, nose2) 2. **Runs appropriate tests** with proper configuration 3. **Provides coverage reporting** if available 4. **Shows clear test results** with failure details

Example Commands

pytest (recommended)

# Run all tests
pytest

# Run with coverage
pytest --cov=src --cov-report=html

# Run specific test file
pytest tests/test_models.py

# Run with verbose output
pytest -v

# Run tests matching pattern
pytest -k "test_user"

unittest

# Run all tests
python -m unittest discover

# Run specific test file
python -m unittest tests.test_models

# Run with verbose output
python -m unittest -v

Django tests

# Run all Django tests
python manage.py test

# Run specific app tests
python manage.py test myapp

# Run with coverage
coverage run --source='.' manage.py test
coverage report

Best Practices

  • Write tests for all critical functionality
  • Use descriptive test names
  • Keep tests isolated and independent
  • Mock external dependencies
  • Aim for high test coverage (80%+)
Ships withclaude-code-templates

Ready-to-use configurations for Anthropic's Claude Code. A comprehensive collection of AI agents, custom commands, settings, hooks, external integrations (MCPs), and project templates to enhance your development workflow.

Get the whole plugin

Other commands on claude-code-templates.