Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Pytest plugin for parametrizing tests with default iterables.

Project description

image image image image image image image image image

Pytest module for parametrizing tests with default iterables, providing alternative syntax for pytest.mark.parametrize.


Decorate tests with iterable default values.


from parametrized import parametrized

def test(name=values, ...):
    """test single parametrized arg with each value"""
def test(name=values, name1=values1, ...):
    """test parametrized args with zipped values"""

def test(name=values, name1=values1, ...):
    """test parametrized args with cartesian product of values"""

Zip before and after example:

@pytest.mark.parametrize("test_input,expected", [
    ("3+5", 8),
    ("2+4", 6),
    ("6*9", 42),
def test_eval(test_input, expected):
    assert eval(test_input) == expected
def test_eval(test_input=["3+5", "2+4", "6*9"], expected=[8, 6, 42]):
    assert eval(test_input) == expected

Product before and after example:

@pytest.mark.parametrize("x", [0, 1])
@pytest.mark.parametrize("y", [2, 3])
def test_foo(x, y):

def test_foo(x=[0, 1], y=[2, 3]):


Parametrized fixtures which simply return their param.

fixture_name = parametrized.fixture(*params, **kwargs)

Before and after example:

@pytest.fixture(params=[0, 1], ids=["spam", "ham"])
def a(request):
    return request.param

a = parametrized.fixture(0, 1, ids=["spam", "ham"])


% pip install pytest-parametrized


100% branch coverage.

% pytest [--cov]



  • Python >=3.6 required


  • Namespace plugin removed


  • pytest 4 compatibility


  • parametrized keyword options


  • fixture keyword options

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-parametrized, version 1.3
Filename, size File type Python version Upload date Hashes
Filename, size pytest_parametrized-1.3-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pytest-parametrized-1.3.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page