From quality-tools
Pytest fixtures, parametrization, mocking, and test organization patterns. PROACTIVELY activate for: (1) Writing pytest test suites, (2) Creating fixtures, (3) Implementing parametrized tests, (4) Mocking external dependencies, (5) Organizing test directories. Triggers: "pytest", "fixture", "parametrize", "mock", "python test", "unittest", "conftest"
How this skill is triggered — by the user, by Claude, or both
Slash command
/quality-tools:python-testing-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Keywords**: pytest, fixture, parametrize, mock, python test, unittest
Keywords: pytest, fixture, parametrize, mock, python test, unittest
File Patterns: test_*.py, *_test.py
Modes: testing_backend
import pytest
@pytest.fixture
def database():
"""Create test database"""
db = setup_database()
yield db # Provide to test
teardown_database(db) # Cleanup
def test_query(database):
result = database.query("SELECT * FROM users")
assert result is not None
Scopes: function (default), class, module, session
@pytest.mark.parametrize("input,expected", [
(3, 9),
(4, 16),
(-2, 4),
])
def test_square(input, expected):
assert square(input) == expected
from unittest.mock import patch, MagicMock
def test_api_call():
with patch('requests.get') as mock_get:
mock_get.return_value.json.return_value = {'data': 'test'}
result = fetch_data('https://api.example.com')
assert result == {'data': 'test'}
mock_get.assert_called_once()
tests/
├── unit/
│ ├── test_auth.py
│ └── test_models.py
├── integration/
│ └── test_api.py
└── conftest.py # Shared fixtures
npx claudepluginhub agentient/vibekit --plugin quality-toolsProvides pytest patterns for Python testing: fixtures, parametrization, mocking, markers, and exception testing. Useful when writing or reviewing unit/integration tests.
Writes pytest tests using fixtures, parametrization, mocking, async patterns, and AAA structure. Use for creating or updating Python test files, not unittest.
Implements Python testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests or setting up test suites.