$npx skillfedfor your agent

Pytest

Master pytest for Python testing with guidance on fixtures, parametrization, markers, and mocking strategies. Learn test organization patterns, coverage best practices, and common commands to streamline your testing workflow.

Pytest helps you run and execute Python unit tests with fixtures, parametrization, mocking, and coverage tracking.

AI-generated summary based on this skill's SKILL.md

6 1 unlicensed, metadata onlyupdated by eyadsibai

Decision gist · record as of 2026-01-15

Pytest helps you run and execute Python unit tests with fixtures, parametrization, mocking, and coverage tracking. Master pytest for Python testing with guidance on fixtures, parametrization, markers, and mocking strategies. Learn test organization patterns, coverage best practices, and common commands to streamline your testing workflow.

manual: git clone https://github.com/eyadsibai/ltk → cp -r ltk ~/.claude/skills/pytest

Use it when

  • Pytest fixtures are reusable test components that set up preconditions and clean up after tests.
  • Pytest parametrize uses the `@pytest.mark.parametrize` decorator to run the same test with different input values.
Same gist for agents: .md · .json

Install

eyadsibai/ltk/pytest · repository language: Python

generated, unverified - the skill's exact subdirectory could not be determined; check the repository on GitHub

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I use pytest to run and execute Python unit tests?

Pytest runs tests by discovering test files (test_*.py or *_test.py) and test functions (test_*) in your project. Execute tests with `pytest` from your project root, or target specific files: `pytest test_module.py`. Pytest automatically collects and runs all matching tests, displaying results with pass/fail status and detailed failure information.

What are pytest fixtures and how do I use them?

Pytest fixtures are reusable test components that set up preconditions and clean up after tests. Define fixtures with the `@pytest.fixture` decorator, then pass them as function arguments to your test functions. Fixtures support setup/teardown logic, parametrization, and scoping (function, class, module, session) to control their lifecycle and reuse across multiple tests.

How can I parametrize tests to run multiple test cases?

Pytest parametrize uses the `@pytest.mark.parametrize` decorator to run the same test with different input values. Specify parameter names and a list of value tuples: `@pytest.mark.parametrize('input,expected', [(1, 2), (3, 4)])`. This generates separate test runs for each parameter set, reducing code duplication and improving test coverage.

What pytest command line options are most useful?

Pytest command line options include: `-v` for verbose output, `-s` to show print statements, `-k` to filter tests by name, `--tb=short` for concise tracebacks, `--lf` to run last failed tests, `-x` to stop on first failure, and `--cov` for coverage reports. Combine options for flexible test execution: `pytest -v -s --tb=short test_file.py`.

How do I generate test coverage reports with pytest?

Pytest generates coverage reports using the pytest-cov plugin. Install with `pip install pytest-cov`, then run `pytest --cov=module_name` to measure code coverage. Add `--cov-report=html` to generate an HTML report, or `--cov-report=term-missing` to display uncovered lines in terminal output. Coverage helps identify untested code paths.

What's the difference between pytest and unittest?

Pytest offers simpler syntax (plain functions vs. class-based tests), powerful fixtures (vs. setUp/tearDown), parametrization, and better assertion introspection. Pytest requires less boilerplate and provides richer plugin support. Unittest is Python's standard library framework with more verbose structure. Pytest is generally preferred for modern Python projects due to its flexibility and ease of use.

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Run and execute Python unit tests using pytest framework”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

python-testing
by JosiahSiegel · JosiahSiegel/claude-plugin-marketplace

Learn to build robust test suites using pytest with fixtures at multiple scopes, parameterized test cases, and mocking strategies. This skill covers async testing patterns, FastAPI application testing, and property-based testing approaches to ensure comprehensive coverage and maintainable test code.

MITupdated Jun 2026
★ 49repo stars
pytest
by xobotyi · xobotyi/cc-foundry

Master pytest's core patterns for writing maintainable tests: fixtures for setup and teardown, parametrize for test variations, and monkeypatch for mocking. Learn test structure, granularity, and scope management to build fast, isolated unit tests that serve as executable documentation.

MITupdated Jul 2026
★ 18repo stars
pytest
by bobmatnyc · bobmatnyc/claude-mpm-skills

pytest is Python's standard testing framework, enabling developers to write organized unit and integration tests through fixtures for dependency injection and parametrization for data-driven test cases. It supports async code, multiple test discovery patterns, and integrates seamlessly with FastAPI, Django, and Flask, plus a rich plugin ecosystem for coverage, mocking, and parallel execution.

MITupdated Jul 2026
★ 62repo stars
Pytest Patterns
by hieutrtr · hieutrtr/ai1-skills

Pytest Patterns teaches structured testing for Python backends using pytest, httpx, and factory_boy. Learn to organize tests across unit and integration layers, build reusable fixtures with proper scoping, seed test data with factories, and test async FastAPI endpoints. Covers mocking, parametrization, and conftest hierarchy—but skips frontend and E2E testing.

no license declared → metadata onlyupdated Feb 2026
★ 8repo stars
pytest-skill
by LambdaTest · LambdaTest/agent-skills

pytest-skill equips you with patterns for writing robust Python tests using pytest's core features: fixtures for setup and teardown, parametrize for data-driven testing, markers for test organization, and mocking for external dependencies. It covers conftest configuration, exception handling, and best practices for production environments.

MITupdated Jul 2026
★ 339repo stars
test-harness
by Mathews-Tom · Mathews-Tom/armory

Test Harness builds complete pytest test files from source code, automatically structuring tests across happy paths, edge cases, and error states. It designs fixtures by scope, applies focused mocks to external dependencies, and handles async patterns—all grounded in reconnaissance of your code's complexity and existing test coverage.

MITupdated Jul 2026
★ 274repo stars

More skills python-testing-patterns (MIT) · Pytest Patterns (unlicensed) · python-testing-patterns (MIT)

Tags
test-automationpython-testingquality-assurancecontinuous-integrationcode-validationdeveloper-toolstest-frameworkdebugging-support