Files
ai-skills/skills/python-development-tests/SKILL.md
Oleg Yurchik b8388fa4a2 Add database, telegram bot, and tests skills; update stack and fastapi skills
- Add python-development-database skill: metaorm patterns for tables, repositories, filters, settings, transactions, pagination, and exceptions
- Add python-development-telegram-bot skill: aiogram bot service with polling/webhook, router structure, middlewares, inline keyboards, and pagination
- Add python-development-tests skill: test organization guidelines with pytest, fixtures, and dependency injection rules
- Update python-development-stack: replace SQLModel/SQLAlchemy with metaorm; add pytest, pytest-asyncio, pytest-cov, faker
- Update python-development-fastapi: add sections for dependencies and list endpoints with ListResponse schema
- Update python-development-code-style: allow ctx as exception for typer.Context parameter
- Update python-development index with links to all three new skills

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-10-26 14:04:05 +03:00

19 lines
1.1 KiB
Markdown

---
name: python-development-tests
description: Guidelines for writing and organizing tests in Python services. Use when creating or modifying tests, fixtures, or test configuration.
---
## Rules
- All tests are located in the `tests` folder at the repository root.
- The test directory structure mirrors the structure of the tested package. For example, if a module is at `project/database/service.py`, the corresponding test must be at `tests/database/test_service.py`.
- Do **not** test protected methods or functions (`_method`, `_function`).
- Do **not** rely on or verify internal implementation details in tests.
- Use only public classes, objects, functions, and methods — and test only them.
- Do **not** use `monkeypatch` or any form of patching in tests.
- If internal behavior of an object needs to be changed, pass a mock object via the constructor or function argument (dependency injection).
- Actively use fixtures and `parametrize` for tests.
- All fixtures are stored in `conftest.py`.
- Every test package has its own `conftest.py`.
- Make tests asynchronous where applicable.