testing-guidelines
Pytest testing patterns, fixtures, mocking, and coverage for GMailArchiver. Use when writing unit tests, integration tests, creating fixtures, mocking Gmail API, or checking coverage. Triggers on: test, pytest, fixture, mock, coverage, conftest, assert, unit test, integration test.
When & Why to Use This Skill
This Claude skill provides comprehensive testing guidelines for the GMailArchiver project, focusing on Pytest patterns, fixture management, and Gmail API mocking. It streamlines the development of high-quality unit and integration tests while ensuring adherence to strict code coverage standards and best practices.
Use Cases
- Developing unit and integration tests using Pytest for GMailArchiver modules to ensure code reliability.
- Implementing sophisticated mocking strategies for the Gmail API to create isolated and predictable test environments.
- Configuring and utilizing shared fixtures in conftest.py to reduce boilerplate and improve test maintainability.
- Executing and analyzing code coverage reports to monitor progress toward the project's 95% coverage target.
- Standardizing test naming conventions and organization based on the authoritative source documentation.
| name | testing-guidelines |
|---|---|
| description | >- |
| Gmail API, or checking coverage. Triggers on | test, pytest, fixture, mock, |
Testing Guidelines for GMailArchiver
This skill provides guidance on testing practices and patterns.
Source Documentation
Always read the authoritative source:
docs/TESTING.md - The definitive testing guidelines document containing:
- Test organization and structure
- Naming conventions for tests
- Fixture patterns and usage
- Mocking strategies (especially for Gmail API)
- Coverage requirements and targets
- Integration vs unit test guidelines
- Test data management
Key Test Files
tests/conftest.py- Shared fixtures and configurationtests/test_*.py- Test modules (match source structure)
Test Commands
# Run all tests with coverage
uv run pytest
# Run specific test file
uv run pytest tests/test_module.py -v
# Run specific test function
uv run pytest tests/test_module.py::test_name -v
# Run without coverage (faster)
uv run pytest --no-cov
# Run with coverage report
uv run pytest --cov=src/gmailarchiver --cov-report=html
Coverage Requirements
- Overall: 95%+ coverage
- Core modules: Higher coverage expected
- See
docs/TESTING.mdfor specific targets
Usage
When writing tests:
- Read
docs/TESTING.mdfor current testing guidelines - Check
tests/conftest.pyfor available fixtures - Follow existing test patterns in similar test files
- If guidelines change, update
docs/TESTING.md(not this skill)
The source documentation is the single source of truth - this skill just points you there.