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

Better message in case of not using parametrized variable #1539

Closed
pwilczynskiclearcode opened this Issue Apr 28, 2016 · 5 comments

Comments

Projects
None yet
5 participants
@pwilczynskiclearcode

pwilczynskiclearcode commented Apr 28, 2016

py.test 2.9.1

In case of not using one of parametrized variables the following message is displayed:

/python2.7/site-packages/_pytest/python.py:237: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
/python2.7/site-packages/_pytest/python.py:1000: in parametrize
    raise ValueError("%r uses no fixture %r" %(self.function, arg))
E   ValueError: <function test_abc at 0x7f9bb394dde8> uses no fixture u'suffix'

where suffix isn't a fixture but missed variable from pytest.mark.parametrize.

Suggested enhancement: Raise Exception with a message suggesting using the suffix variable and not confuse developers about suffix fixture.

@The-Compiler

This comment has been minimized.

Member

The-Compiler commented Apr 28, 2016

It is a fixture from pytest's point of view - but I'd also be okay with the error saying "argument" instead of "fixture". "variable" is even more confusing, IMHO.

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Apr 28, 2016

for parametrize, in case of direct "arguments" we should use names that make the most sense

for a good error we should take a look if there is a indirect fixture that takes parameters (needs indirect=True) or if the parameter is just missing (maybe typo detection)

@hackebrot

This comment has been minimized.

Member

hackebrot commented Jul 23, 2016

I'd say we change the ValueError to report an issue

  • with argument if parameter is not indirect
  • with fixture if parameter is indirect

jjanczyszyn added a commit to jjanczyszyn/pytest that referenced this issue Jul 23, 2016

@hackebrot

This comment has been minimized.

Member

hackebrot commented Jul 23, 2016

Please review #1757

@nicoddemus nicoddemus closed this Jul 24, 2016

@nicoddemus

This comment has been minimized.

Member

nicoddemus commented Jul 24, 2016

Fixed in #1757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment