Imagine a toy test definition:
@pytest.mark.parametrize("bar", [1, 2, 3])
def test_foo(bar):
assert some_result(bar)
I now want to be able to provide bar on the command line. As far as I know this is not built into Py.Test yet:
pytest --param "bar=7"
And write my test parameter definition like this:
@pytest.mark.parametrize(*from_args_if_available("bar", [1, 2, 3]))
def test_foo(bar):
assert some_result(bar)
I can implement from_args_if_available() parsing all command line arguments again and looking for --params of course. Another way would be to make request.config available globally (which would be ugly).
I wonder if it's possible to access the request.config element from anywhere in order to have all command line option definition at one place (and thus the help).
So is there another way to access the parsed command line options which I can use in the described way?