parametrize
Drop-in @pytest.mark.parametrize replacement working with unittest.TestCase
Decision gist · record as of 2026-08-14
Yes, if you have a large unittest codebase and want to adopt pytest-style parameterization without a full rewrite. The package is stable, has no dependencies, and works well for its narrow purpose. However, the dormant maintenance status and strict decorator-ordering rules mean it's best suited for teams committed to pytest as their long-term test runner. If you're starting fresh or can migrate fully to pytest, use pytest's native parametrize instead.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Parametrized tests must be run via pytest CLI (e.g., `pytest test.py`), not `python -m unittest`; decorator assignment must occur at class or module scope, not inside function scope.
- No runtime dependencies and a pure-Python wheel make installation straightforward.
- The package is dormant (last release May 2021, last commit December 2024) but remains stable for its narrow use case.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for most projects.
last release 2021-05-09 (1923 days) · last repo commit 2024-12-19 · 18 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 88,835 downloads/mo, #13,700 on PyPI
Alternatives
Verify before relying
import unittest
from parametrize import parametrize
class TestSomething(unittest.TestCase):
@parametrize('test_input,expected', [("3+5", 8), ("2+4", 6)])
def test_eval(self, test_input, expected):
self.assertEqual(expected, eval(test_input))- Whether the package's decorator interoperability with pytest.mark.parametrize is complete enough for gradual migration scenarios.
- How well the package handles edge cases with complex mock.patch stacking or other decorators in real projects.
What it is and what it does
Parametrize is a decorator-based test parameterization library that lets you use pytest-style `@parametrize` syntax within `unittest.TestCase` classes. It generates multiple test variants from a single test method, each with different input and expected values, without requiring you to rewrite your existing `setUp`, `tearDown`, or `self.assert*` calls. The decorator works by introspecting the call stack and class scope to dynamically create parameterized test methods at runtime.
The package is designed as a bridge for teams stuck on unittest who want to adopt pytest's parameterization pattern incrementally. It supports stacking multiple `@parametrize` decorators to create Cartesian products of test cases, and integrates with PyCharm's test runner. However, it has strict limitations: all parameterization must use decorators (not applied after definition), other decorators must come before parametrize decorators, and parametrized tests must be run through pytest rather than the standard unittest CLI.
Use it for
- Gradually migrate a large unittest codebase to pytest-style parameterization without rewriting all test methods at once.
- Run the same test logic with multiple input sets in unittest without manually duplicating test methods or using loops.
- Combine multiple parameter dimensions (e.g., different inputs and expected outputs) using stacked decorators to test all combinations.
- Keep existing unittest infrastructure (setUp, tearDown, self.assert methods) while adopting pytest's cleaner parameterization syntax.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have a large unittest codebase and want to adopt pytest-style parameterization without a full rewrite.
The package is stable, has no dependencies, and works well for its narrow purpose. However, the dormant maintenance status and strict decorator-ordering rules mean it's best suited for teams committed to pytest as their long-term test runner. If you're starting fresh or can migrate fully to pytest, use pytest's native parametrize instead.
Install
parametrize on PyPI
Before you install
No runtime dependencies and a pure-Python wheel make installation straightforward. The package is dormant (last release May 2021, last commit December 2024) but remains stable for its narrow use case.
Parametrized tests must be run via pytest CLI (e.g., `pytest test.py`), not `python -m unittest`; decorator assignment must occur at class or module scope, not inside function scope.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
import unittest
from parametrize import parametrize
class TestSomething(unittest.TestCase):
@parametrize('test_input,expected', [("3+5", 8), ("2+4", 6)])
def test_eval(self, test_input, expected):
self.assertEqual(expected, eval(test_input))
Verify before relying
- Whether the package's decorator interoperability with pytest.mark.parametrize is complete enough for gradual migration scenarios.
- How well the package handles edge cases with complex mock.patch stacking or other decorators in real projects.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.6.2,<4.0.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 1,923 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 88,835 / month, #13,700 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: LibrariesTopic :: Software Development :: TestingTopic :: Software Development :: Testing :: UnitTyping :: Typed |
Evidence: parametrize-0.1.1-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 › “parametrize unittest tests”
- parametrizeProvides a `@parametrize` decorator that works with…
- unittest-parametrizeAdds parametrization support to unittest TestCases, allowing you to…
- pytestpytest is a testing framework that lets you write test functions…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
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.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
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.
See also parameterized · pytest-cases · testscenarios · unittest-parametrize · pytest-subtests · pytest-parametrization · pytest-lazy-fixture · ddt · pytest-lazy-fixtures · vcrpy-unittest