Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clarify docs on Multiple Calls to metafunc.parametrize #1548

astraw38 opened this Issue May 4, 2016 · 2 comments


None yet
2 participants
Copy link

astraw38 commented May 4, 2016

The docs say "Add new invocations to the underlying test function using the list of argvalues for the given argnames."; which would imply that you could call it multiple times to add more invocations.

It's a relatively minor issue, since you can store off into a final parametrization list then call it once later, but it should probably be noted in the docs.

Simple test of the form:

# in
def pytest_generate_tests(metafunc):
                         [1, 2],
                         [3, 4],

# in
def test_me(self,  arg1):
    assert arg1

The output of the example above:

==================================== ERRORS ====================================
_____________________ ERROR collecting _____________________
../../../.PyCharm50/config/scratches/pytesting/ in pytest_generate_tests
/usr/local/lib/python2.7/site-packages/_pytest/ in parametrize
/usr/local/lib/python2.7/site-packages/_pytest/ in setmulti
/usr/local/lib/python2.7/site-packages/_pytest/ in _checkargnotcontained
    raise ValueError("duplicate %r" %(arg,))
E   ValueError: duplicate 'arg1'
=========================== 1 error in 0.19 seconds ============================

This comment has been minimized.

Copy link

RonnyPfannschmidt commented May 4, 2016

this works as designed, per parameter name set you get one call (else things get really tricky)


This comment has been minimized.

Copy link

astraw38 commented May 4, 2016

I figured as much, but it should be noted in the docs to remove ambiguity.

@RonnyPfannschmidt RonnyPfannschmidt changed the title Multiple Calls to metafunc.parametrize fail clarify docs on Multiple Calls to metafunc.parametrize May 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.