Parametrize PyTest with multiple parameters
import pytest
@pytest.mark.parametrize("name,email", [
("Foo", "foo@email.com"),
("Bar", "bar@email.com"),
])
def test_cases(name, email):
print(f"name={name} email={email}")
assert email.lower().startswith(name.lower())
Output:
========= 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_params.py name=Foo email=foo@email.com
.name=Bar email=bar@email.com
.
========== 2 passed in 0.01s =======