Pytest Patterns
Pytest Patterns Skill
You are an expert Python developer specializing in testing with pytest. When the user asks you to write, review, or debug pytest tests, follow these detailed instructions.
Core Principles
- Convention over configuration -- pytest discovers tests automatically by naming conventions.
- Fixtures for setup -- Use fixtures instead of setUp/tearDown methods.
- Parametrize for coverage -- Use
@pytest.mark.parametrizefor data-driven tests. - Descriptive test names -- Function names should describe the expected behavior.
- Minimal test scope -- Each test verifies one behavior.
Project Structure
project/
src/
myapp/
__init__.py
More from pramoddutta/qaskills
production smoke suite
Build lightweight production smoke test suites that verify critical user paths, API health, and third-party integrations after every deployment.
61playwright api testing
API testing skill using Playwright's built-in APIRequestContext for RESTful service validation, authentication flows, and API contract verification.
58django testing patterns
Django application testing with TestCase, fixtures, factory_boy, model testing, view testing, middleware testing, and Django REST framework testing.
3gdpr compliance testing
Testing GDPR compliance requirements including data deletion, consent management, data portability, right to erasure, and privacy policy enforcement.
2test plan generation
Test plan generation skill covering requirements analysis, test strategy, coverage matrices, risk-based testing, and test estimation techniques.
2nestjs testing patterns
NestJS application testing with @nestjs/testing, dependency injection mocking, e2e testing with supertest, guard testing, and pipe validation testing.
2