Registry / testing / parametrize

parametrize

JSON →
library0.1.1pypypi✓ verified 84d ago

A drop-in replacement for @pytest.mark.parametrize that works with unittest.TestCase classes, enabling parameterized tests without needing pytest. Current version 0.2.0. Development appears low-activity.

pip install parametrize
INSTALL
IMPORT
SIG · PARAMETRIZE
P
parametrize
testingpythonv0.1.1
Install
1.5s avg
Import
33ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.032s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.034s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parametrize
from parametrize import parametrize
import parametrize
Direct import without submodule leads to AttributeError on parametrize decorator.

Basic usage with unittest.TestCase showing parameterized tests.

import unittest from parametrize import parametrize class TestMath(unittest.TestCase): @parametrize('a,b,expected', [ (1, 1, 2), (2, 2, 4), (3, 5, 8) ]) def test_add(self, a, b, expected): self.assertEqual(a + b, expected) if __name__ == '__main__': unittest.main()
Debug
Known issues
deprecatedparametrize is not actively maintained; consider using pytest's built-in parametrize directly if you can migrate tests away from unittest.TestCase.
fix
Use @pytest.mark.parametrize and run tests with pytest instead of unittest.
affects: all
gotchaThe decorator must be placed above the method definition, not below. Placing it below will silently not work.
fix
Ensure @parametrize is directly above the test method, with no other decorator in between.
affects: all
gotchaArgument names in the string must exactly match method parameters. A mismatch will cause a TypeError at test execution.
fix
Check that the comma-separated argument names match the method signature.
affects: all
Errors
Common errors & fixes
AttributeError: module 'parametrize' has no attribute 'parametrize'
Import using import parametrize instead of from parametrize import parametrize.
fix
from parametrize import parametrize
TypeError: test_add() missing 2 required positional arguments: 'b' and 'expected'
Argument names in the decorator string do not match method parameters, or the tuple lengths mismatch.
fix
Ensure the argument names string (e.g., 'a,b,expected') matches method parameters exactly.
ValueError: not enough values to unpack (expected x, got y)
Number of values in a test case tuple does not match the number of argument names.
fix
Each test tuple must have exactly as many elements as argument names.
Upgrade
Version history
0.1.1latest on PyPI · released May 9, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
parametrize — pip install parametrize · libregistry