--- id: pytest-cases version: "3.10.1" license: BSD 3-Clause license_treatment: permissive maintenance: active --- # pytest-cases — Separate test code from test cases in pytest. License: permissive · Maintenance: active · Downloads: 1.0M/mo ## What it is and what it does pytest-cases is a pytest plugin that decouples test case definitions from test execution logic. Instead of embedding all test data inline or using pytest's built-in parametrize, you define cases separately (via decorators, fixtures, or data files) and reference them in test functions. The plugin handles the plumbing to inject each case into your test, reducing boilerplate and making test suites easier to maintain when you have many cases or shared test data. It depends on pytest as its core framework, plus decopatch and makefun for decorator manipulation, and packaging for version handling. The package is actively maintained and classified as Production/Stable, with support for Python 3.9 through 3.14. Use it for: - Organize large test suites where many test functions share the same logic but differ only in input data. - Load test cases from external files or databases without hardcoding them into test functions. - Reuse the same test case set across multiple test functions without duplication. - Implement lazy-loaded test cases that are only instantiated when the test runs. - Combine multiple case sources (fixtures, decorators, data files) in a single parametrized test. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. pytest-cases lets you separate test case data from test code in pytest, using decorators and fixtures to parametrize tests with external data sources. Yes. pytest-cases is actively maintained, has no known vulnerabilities, and solves a real problem in test organization. The low install friction and permissive license make it a straightforward addition to any pytest-based project. Install it if you have test suites with many cases or external test data that you want to keep separate from your test logic. ## Install pip install pytest-cases uv add pytest-cases poetry add pytest-cases ## Installing pytest-cases Before you install: Low install friction with a pure-Python wheel distribution. Actively maintained as of March 2026 with recent commits. Depends on pytest and three utility packages (decopatch, makefun, packaging), all common in Python testing environments. License in practice: BSD 3-Clause is permissive; you can use this package in commercial and proprietary projects with minimal restriction, provided you include the license text. Quickstart: pip install pytest-cases from pytest_cases import CaseData, parametrize_with_cases @parametrize_with_cases def test_example(case_data): assert case_data is not None Verify before relying: - Whether the package supports Python versions earlier than 3.9 (classifiers list 3.9 as minimum but requires_python is unspecified) - How test case data is typically sourced (files, functions, external datasets) beyond the decorator API ## Package facts - License: BSD 3-Clause (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 1.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest parametrize test cases, separate test data from code, pytest test case decorator, parametrized testing pytest, pytest fixture data management, lazy test case loading, pytest case-driven testing, pytest-plugin, test-parametrization, data-driven-testing [View on SkillFed](https://skillfed.io/packages/pytest-cases) · [View on PyPI](https://pypi.org/project/pytest-cases/)