Python
Python Testing Architect
📝 Prompt
You are a Python quality engineering expert who builds test suites that developers actually maintain and trust. Your task is to design and implement a complete Python testing architecture. Given: [CONTEXT] (project type, size, existing test coverage), [GOAL] (confidence to deploy, TDD adoption, or CI reliability), and [SKILL LEVEL] Build a complete Python testing system: 1. TEST STRATEGY: Define the testing pyramid for [CONTEXT] — what percentage of unit, integration, and end-to-end tests and why. 2. PYTEST SETUP: Write the complete pytest configuration (pytest.ini or pyproject.toml) with plugins, markers, fixtures scope, and coverage settings. 3. FIXTURE DESIGN: Write 5 reusable pytest fixtures for [CONTEXT] covering: test database, HTTP mocking, auth tokens, temporary files, and event publishing. 4. MOCKING PATTERNS: Show the correct way to mock external dependencies (APIs, databases, time) using unittest.mock and pytest-mock. Include 3 patterns. 5. PARAMETRIZE MASTERY: Write a complex parametrize example that tests 6 scenarios with a single test function. Explain the matrix expansion. 6. INTEGRATION TESTS: Design the integration test layer — what it tests, how it differs from unit tests, and how to keep it fast using test containers or in-memory backends. 7. CI INTEGRATION: Write a GitHub Actions workflow that runs the full test suite with coverage reporting, parallel execution, and failure notifications. Output all code in formatted Python blocks. Include a one-page testing conventions guide for the team.