Install any skill in seconds. Free to start, no credit card required.
Get Started Free →xu-xiang/django-tdd
使用 pytest-django 进行 Django 测试的策略、TDD 方法论、factory_boy、Mock 模拟、测试覆盖率以及测试 Django REST Framework API。
Passed 17 of 22 test cases with the skill, and 12 of 22 without it.
and 5 more in the full report
6 fixed11 passed either way4 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 6 test cases the skill fixed. Same model, same prompt, with and without the skill.
In our pytest-django setup, we want to ensure all tests run under a consistent UTC timezone automatically without having to manually set it in every test function. Write an autouse fixture in `conftest.py` that enforces this.
| Checked | Without skill | With skill |
|---|---|---|
| Uses @pytest.fixture(autouse=True) for the timezone fixture function. | Passed | Passed |
| Sets settings.TIME_ZONE = 'UTC' inside the timezone fixture. | Missed | Passed |
The instructions your model reads when the skill loads.
使用 pytest、factory_boy 和 Django REST Framework 进行 Django 应用程序的测试驱动开发。
# 步骤 1: RED - 编写一个失败的测试
def test_user_creation():
user = User.objects.create_user(email='[email protected]', password='testpass123')
assert user.email == '[email protected]'
assert user.check_password('testpass123')
assert not user.is_staff
# 步骤 2: GREEN - 使测试通过
# 创建 User 模型或 Factory
# 步骤 3: REFACTOR - 在保持测试通过的同时进行改进
# pytest.ini
[pytest]
DJANGO_SETTINGS_MODULE = config.settings.test
testpaths = tests
python_files = test_*.py
python_classes = Test*
test cases passed, vs 12 / 22 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.