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

AssertionError with wrong number of parametrize arguments #2383

Closed
The-Compiler opened this issue Apr 27, 2017 · 2 comments
Closed

AssertionError with wrong number of parametrize arguments #2383

The-Compiler opened this issue Apr 27, 2017 · 2 comments

Comments

@The-Compiler
Copy link
Member

@The-Compiler The-Compiler commented Apr 27, 2017

This:

import pytest

@pytest.mark.parametrize('foo, bar', [(1, 2, 3)])
def test_foo(foo, bar):
    pass

gives us:

../proj/pytest/_pytest/runner.py:157: in __init__
    self.result = func()
../proj/pytest/_pytest/runner.py:328: in <lambda>
    lambda: list(collector.collect()),
../proj/pytest/_pytest/python.py:402: in collect
    return super(Module, self).collect()
../proj/pytest/_pytest/python.py:314: in collect
    res = self.makeitem(name, obj)
../proj/pytest/_pytest/python.py:326: in makeitem
    collector=self, name=name, obj=obj)
../proj/pytest/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../proj/pytest/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
../proj/pytest/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
../proj/pytest/_pytest/vendored_packages/pluggy.py:613: in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
../proj/pytest/_pytest/vendored_packages/pluggy.py:250: in _wrapped_call
    wrap_controller.send(call_outcome)
../proj/pytest/_pytest/python.py:185: in pytest_pycollect_makeitem
    res = list(collector._genfunctions(name, obj))
../proj/pytest/_pytest/python.py:346: in _genfunctions
    self.ihook.pytest_generate_tests(metafunc=metafunc)
../proj/pytest/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
../proj/pytest/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
../proj/pytest/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
../proj/pytest/_pytest/vendored_packages/pluggy.py:614: in execute
    res = hook_impl.function(*args)
../proj/pytest/_pytest/python.py:112: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
../proj/pytest/_pytest/python.py:846: in parametrize
    assert len(param.values) == len(argnames)
E   AssertionError

it'd be nice to show a proper error message instead.

@nicoddemus
Copy link
Member

@nicoddemus nicoddemus commented Apr 27, 2017

👍

robin0371 added a commit to robin0371/pytest that referenced this issue Apr 29, 2017
…parametrize" func with wrong args and add test for this case.
The-Compiler added a commit that referenced this issue Apr 29, 2017
Issue #2383 - AssertionError with wrong number of parametrize arguments
@nicoddemus
Copy link
Member

@nicoddemus nicoddemus commented Apr 29, 2017

Fixed in #2386

This was referenced Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants