def pytest_generate_tests(metafunc):
    if metafunc.config.option.repeat is not None:
        count = int(metafunc.config.option.repeat)
metafunc.fixturenames.append('tmp_ct')
metafunc.parametrize('tmp_ct', list(range(count)))
How can I repeat each test multiple times in a py.test run?