parametrize PyTest with pytest.mark.parametrize



examples/pytest/test_with_param.py
import pytest

@pytest.mark.parametrize("name", ["Foo", "Bar"])
def test_cases(name):
    print(f"name={name}")
    assert len(name) == 3

======== test session starts ========
platform linux -- Python 3.7.3, pytest-5.3.2, py-1.8.0, pluggy-0.13.0
rootdir: /home/gabor/work/slides/python-programming/examples/pytest
plugins: flake8-1.0.4
collected 2 items

test_with_param.py name=Foo
.name=Bar
.

=========== 2 passed in 0.00s ========