skills/testing-skills/pytest/SKILL.md
Provides comprehensive guidance for pytest testing framework including test writing, fixtures, parametrization, mocking, and plugins. Use when the user asks about pytest, needs to write Python tests, use pytest fixtures, or configure pytest for Python projects.
npx skillsauth add partme-ai/full-stack-skills pytestInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill whenever the user wants to:
pytest-mock or unittest.mockpytest.ini, pyproject.toml, or conftest.pypytest-covpytest-xdisttest_ prefix or Test classconftest.py for shared setup and dependency injectionpytest CLI, applying markers and filters as neededdef test_addition():
assert 1 + 1 == 2
def test_string_upper():
assert "hello".upper() == "HELLO"
import pytest
@pytest.fixture
def sample_user():
return {"name": "Alice", "email": "[email protected]"}
def test_user_name(sample_user):
assert sample_user["name"] == "Alice"
@pytest.fixture(autouse=True)
def reset_database(db):
db.clear()
yield
db.clear()
import pytest
@pytest.mark.parametrize("input,expected", [
("hello", 5),
("", 0),
("pytest", 6),
])
def test_string_length(input, expected):
assert len(input) == expected
def test_api_call(mocker):
mock_get = mocker.patch("requests.get")
mock_get.return_value.json.return_value = {"status": "ok"}
result = fetch_status()
assert result == "ok"
mock_get.assert_called_once()
# Run all tests
pytest
# Verbose with pattern filter
pytest -v -k "test_user"
# With coverage
pytest --cov=mypackage --cov-report=html
# Parallel execution
pytest -n auto
conftest.py for shared fixtures--cov for coverage and --maxfail=1 to fail fast@pytest.mark.slow) to categorize tests and run subsetspytest, Python testing, fixtures, parametrize, mocking, conftest, coverage, pytest-cov, pytest-xdist, unit testing, markers
development
Provides per-component and per-API examples with cross-platform compatibility details for uni-app, covering built-in components, uni-ui components, and APIs (network, storage, device, UI, navigation, media). Use when the user needs official uni-app components or APIs, wants per-component examples with doc links, or needs platform compatibility checks.
tools
Creates new uni-app projects via the official CLI or HBuilderX with Vue 2/Vue 3 template selection, manifest.json and pages.json configuration, and directory structure setup. Use when the user wants to scaffold a new uni-app project, initialize project files with a single command, or set up the development environment.
tools
Browses, installs, configures, and manages plugins from the uni-app plugin market (ext.dcloud.net.cn) including component plugins, API plugins, and template plugins with dependency handling. Use when the user needs to find and install uni-app plugins, configure plugin settings, manage plugin dependencies, or integrate third-party components.
tools
Develops native Android and iOS plugins for uni-app including module creation, JavaScript-to-native communication, and plugin packaging for distribution. Use when the user needs to build custom native modules, extend uni-app with native capabilities (camera, Bluetooth, sensors), or create publishable native plugins.