unittest-parametrize
Parametrize tests within unittest TestCases.
Decision gist · record as of 2026-08-14
Yes. unittest-parametrize is a lightweight, actively maintained tool that solves a genuine pain point in unittest—the lack of native parametrization. It has no security vulnerabilities, minimal dependencies, and works across modern Python versions. If you use unittest or Django's test runner and want to avoid duplicating test code for multiple inputs, it's a straightforward win.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Installs with no dependencies beyond typing-extensions.
- Actively maintained with a recent release and no known vulnerabilities.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
last release 2025-09-09 (339 days) · last repo commit 2026-08-13 · 77 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 247,393 downloads/mo, #8,693 on PyPI
Alternatives
Verify before relying
from unittest_parametrize import ParametrizedTestCase, parametrize
class MyTests(ParametrizedTestCase):
@parametrize("x,expected", [(1, 1), (2, 4)])
def test_square(self, x, expected):
self.assertEqual(x**2, expected)What it is and what it does
unittest-parametrize is a decorator-based library that brings pytest-style parametrization to the standard unittest framework. It lets you write a single test method and run it multiple times with different input values, generating separate named test cases for each parameter set. The decorator works by modifying the test class at definition time using Python's __init_subclass__ hook, creating individual wrapped copies of your test method with unique names—so the parametrization works with any test runner (unittest, Django's test runner, pytest, etc.) and supports both synchronous and asynchronous test methods.
The library mirrors pytest's @pytest.mark.parametrize API closely, accepting argument names as a comma-separated string or sequence, a list of parameter tuples or param objects, and optional custom test ID suffixes. You inherit from ParametrizedTestCase in your test class and apply @parametrize to any test methods you want to parametrize. It handles single parameters without tuple wrapping, multiple parameters, and custom naming via param IDs, a sequence of ID strings, or a callable.
Use it for
- Test the same logic across a range of inputs (e.g., testing a square function with multiple values) without duplicating test code.
- Verify edge cases and boundary conditions by running a single test method with different parameter sets.
- Generate readable test reports with custom test names via param IDs, making failures easier to trace.
- Integrate parametrized tests into Django projects by mixing ParametrizedTestCase into your project's base test case classes.
- Run parametrized tests across different test runners (unittest, pytest, Django) without rewriting test code.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
unittest-parametrize is a lightweight, actively maintained tool that solves a genuine pain point in unittest—the lack of native parametrization. It has no security vulnerabilities, minimal dependencies, and works across modern Python versions. If you use unittest or Django's test runner and want to avoid duplicating test code for multiple inputs, it's a straightforward win.
Install
unittest-parametrize on PyPI
Before you install
Installs with no dependencies beyond typing-extensions. Actively maintained with a recent release and no known vulnerabilities.
Requires Python 3.9 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
Quickstart
from unittest_parametrize import ParametrizedTestCase, parametrize
class MyTests(ParametrizedTestCase):
@parametrize("x,expected", [(1, 1), (2, 4)])
def test_square(self, x, expected):
self.assertEqual(x**2, expected)
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping-extensions |
| Maintenance | Actively maintained 339 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 247,393 / month, #8,693 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Typing :: Typed |
Evidence: unittest_parametrize-1.8.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “parametrized unittest tests”
- unittest-parametrizeAdds parametrization support to unittest TestCases, allowing you to…
- nose2nose2 is a test runner that extends Python's unittest framework with…
- parametrizeProvides a `@parametrize` decorator that works with…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also parametrize · pytest-parametrization · parameterized · pytest-cases · pytest-subtests · softest · pytest-lazy-fixture · ddt · nose2 · concurrencytest