django-tdd
SolidDjango testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.
Testing & QA 201,447 stars
30903 forks Updated yesterday MIT
Install
Quality Score: 93/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# Django テスト駆動開発(TDD)
pytest、factory_boy、Django REST Frameworkを使用したDjangoアプリケーションのテスト駆動開発。
## いつ有効化するか
- 新しいDjangoアプリケーションを書くとき
- Django REST Framework APIを実装するとき
- Djangoモデル、ビュー、シリアライザーをテストするとき
- Djangoプロジェクトのテストインフラを設定するとき
## DjangoのためのTDDワークフロー
### Red-Green-Refactorサイクル
```python
# ステップ1: RED - 失敗するテストを書く
def test_user_creation():
user = User.objects.create_user(email='test@example.com', password='testpass123')
assert user.email == 'test@example.com'
assert user.check_password('testpass123')
assert not user.is_staff
# ステップ2: GREEN - テストを通す
# Userモデルまたはファクトリーを作成
# ステップ3: REFACTOR - テストをグリーンに保ちながら改善
```
## セットアップ
### pytest設定
```ini
# pytest.ini
[pytest]
DJANGO_SETTINGS_MODULE = config.settings.test
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
addopts =
--reuse-db
--nomigrations
--cov=apps
--cov-report=html
--cov-report=term-missing
--strict-markers
markers =
slow: marks tests as slow
integration: marks tests as integration tests
```
### テスト設定
```python
# config/settings/test.py
from .base import *
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
# マイグレーションを無効化して高速化
class DisableMigrations:
def __contains__(self, item):
return True
def __getitem__(self, item):
return None
MIGRATION_MODULES = DisableMigrations()
# より高速なパスワードハッシング
PASSWORD_HASHERS = [
'django....
Details
- Author
- affaan-m
- Repository
- affaan-m/everything-claude-code
- Created
- 4 months ago
- Last Updated
- yesterday
- Language
- JavaScript
- License
- MIT
Integrates with
Similar Skills
Semantically similar based on skill content — not just same category
Testing & QA Solid
django-tdd
Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.
496 Updated 1 months ago
vibeeval Testing & QA Listed
django-tdd
Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.
0 Updated today
Izangi2714 AI & Automation Solid
django-patterns
Django architecture patterns, REST API design with DRF, ORM best practices, caching, signals, middleware, and production-grade Django apps.
201,447 Updated yesterday
affaan-m Testing & QA Listed
python-testing
pytest、TDD方法論、フィクスチャ、モック、パラメータ化、カバレッジ要件を使ったPythonテスト戦略。
0 Updated 2 months ago
adomot Testing & QA Solid
tdd-workflow
TDD 워크플로우 가이드. Red-Green-Refactor 철학, pytest, moto 모킹, 테스트 패턴.
364 Updated today
majiayu000