small medium large xlarge

Generic-user-small
02 Dec 2017, 08:13
Herbert Beemster (1 post)

Hi,

First and foremost: excellent book!

On page 46 there is an example how to pass ids into a parametrize decorator, a task_ids was created for this. A more lazy solution is to pass repr as an ids as this argument can be a string or a callable:

@pytest.mark.parametrize(‘task’, tasks_to_try, ids=repr)

def test_add_5(task):

Result is pretty much similar:

test_add_variety.py::test_add_5[Task(summary=’sleep’, owner=None, done=True, id=None)] PASSED [ 20%]

Herbert.

You must be logged in to comment