django-testing-patterns

Generate Pytest unit tests for Django service methods with mocking.

1|Updated Mar 17, 2025
One-click install
npx skills add https://github.com/MaciWP/CV_Astro --skill django-testing-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: django-testing-patterns
Source: https://github.com/MaciWP/CV_Astro/tree/main/.claude/skills/django-testing-patterns
Command: npx skills add https://github.com/MaciWP/CV_Astro --skill django-testing-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires Django, Pytest, pytest-django, mocker, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and templates for writing high-quality, maintainable tests in Django applications using Pytest, ensuring robust code and efficient development.

Core Features & Use Cases

  • Pytest Integration & Patterns: Setup and best practices for Pytest with Django, including the Arrange-Act-Assert (AAA) pattern.
  • Mocking & Fixtures: Generate mocks for external dependencies and reusable test fixtures (conftest.py) to isolate unit tests.
  • Use Case: Write unit tests for a Django service method that interacts with the database and sends an email, ensuring proper mocking of external calls and adherence to testing best practices.

Quick Start

Generate a Pytest unit test for a Django service method create_user(email, password) that mocks the email sending dependency.