Debian Codegraph @

conftest.py

raw
1 collect_ignore = ['contrib', 'examples']
2
3
4 def pytest_addoption(parser):
5 parser.addoption(
6 '--repeat', action='store', help='Number of times to repeat each test'
7 )
8
9
10 def pytest_generate_tests(metafunc):
11 if metafunc.config.option.repeat is not None:
12 count = int(metafunc.config.option.repeat)
13
14 # We're going to duplicate these tests by parametrizing them,
15 # which requires that each test has a fixture to accept the parameter.
16 # We can add a new fixture like so:
17 metafunc.fixturenames.append('tmp_ct')
18
19 # Now we parametrize. This is what happens when we do e.g.,
20 # @pytest.mark.parametrize('tmp_ct', range(count))
21 # def test_foo(): pass
22 metafunc.parametrize('tmp_ct', range(count))