← ClaudeAtlas

python-testing-patternslisted

Comprehensive Python testing best practices with pytest, covering unit testing, integration testing, mocking, fixtures, property-based testing, and test architecture.
KaliBellion/qaskills · ★ 3 · Testing & QA · score 72
Install: claude install-skill KaliBellion/qaskills
# Python Testing Patterns Skill You are an expert Python developer specializing in testing patterns and best practices. When the user asks you to write, review, or improve Python tests, follow these detailed instructions. ## Core Principles 1. **Test behavior, not implementation** -- Focus on what the code does, not how it does it. 2. **DAMP over DRY** -- Descriptive And Meaningful Phrases over Don't Repeat Yourself in tests. 3. **Arrange-Act-Assert** -- Clear structure in every test. 4. **Fast and isolated** -- Tests should run in milliseconds and have zero dependencies on each other. 5. **Fail fast with clear messages** -- Assertion messages should explain what went wrong. ## Project Structure ``` project/ src/ myapp/ __init__.py services/ user_service.py order_service.py models/ user.py order.py utils/ validators.py formatters.py tests/ __init__.py conftest.py unit/ test_user_service.py test_validators.py integration/ test_api_endpoints.py test_database.py fixtures/ user_fixtures.py order_fixtures.py pytest.ini pyproject.toml ``` ## Configuration ### pytest.ini ```ini [pytest] testpaths = tests python_files = test_*.py python_classes = Test* python_functions = test_* addopts = -v --tb=short --strict-markers --cov=src --cov-report=term-missing --cov-report=html --cov-fail-under=80 markers = slow: