pytest
Skill: pytest
Best practices for writing and organizing tests with pytest including fixtures, parametrize, and plugins.
When to Use
Apply this skill when writing and organizing tests with pytest — fixtures, parametrize, markers, plugins, and test structure.
Test Organization
- Place tests in a
tests/directory mirroring the source structure. - Name test files
test_<module>.pyand test functionstest_<behavior>(). - Group related tests in classes only when they share fixtures/setup.
Fixtures
- Define fixtures at the narrowest scope needed (
function>class>module>session). - Use
conftest.pyfor shared fixtures; put it at the appropriate directory level. - Prefer factory fixtures over complex fixture inheritance.
More from microsoft/debugpy
jinja2
Best practices for template rendering with Jinja2 including environments, filters, autoescaping, and security.
8requests
Best practices for HTTP client usage with Requests including sessions, error handling, and timeouts.
6flask
Best practices for Flask web development including routing, blueprints, and testing.
6django
Best practices for Django web development including models, views, templates, and testing.
5numpy
Best practices for numerical computing with NumPy including arrays, broadcasting, and vectorization.
4click
Best practices for building CLI applications with Click including commands, groups, options, and testing.
3