Python pytest Test Suite Generator

Create comprehensive pytest test suites with fixtures and parametrization

6/11/2026
Prompt
Generate a complete pytest test suite for:

**Project:** {{PROJECT_NAME}}
**Module/Package:** {{MODULE_NAME}}
**Python Version:** {{PYTHON_VERSION}}

**Code to Test:**
```python
{{CODE_TO_TEST}}
```

**Test Requirements:**

1. **Test Structure:**
   - Unit tests for each function/method
   - Integration tests for module interactions
   - conftest.py with shared fixtures

2. **pytest Features to Use:**
   - Fixtures (function/class/module/session scope)
   - Parametrization (@pytest.mark.parametrize)
   - Markers (skip, xfail, slow)
   - Mocking with pytest-mock

3. **Coverage Goals:**
   - Line coverage: {{LINE_COVERAGE}}%
   - Branch coverage: {{BRANCH_COVERAGE}}%

4. **Test Categories:**
   - Happy path tests
   - Error handling tests
   - Edge case tests
   - Performance tests (optional)

5. **Mocking Requirements:**
   - External API calls
   - Database connections
   - File system operations
   - Time-dependent code

**Generate:**
- Test file structure
- conftest.py with fixtures
- Parametrized test cases
- pytest.ini configuration
- Coverage configuration

Or press ⌘C to copy

Variables (6)

Replace these placeholders with your own content before using the prompt.

[{PROJECT_NAME][{MODULE_NAME][{PYTHON_VERSION][{CODE_TO_TEST][{LINE_COVERAGE][{BRANCH_COVERAGE]

Ready to use?

Copy and paste into your favorite AI tool

Works With

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...