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
Labels
good first issue easy issue that is friendly to new contributor topic: collection related to the collection phase topic: parametrize related to @pytest.mark.parametrize

Comments

@The-Compiler
Copy link
Member

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.

@The-Compiler The-Compiler added topic: collection related to the collection phase good first issue easy issue that is friendly to new contributor topic: parametrize related to @pytest.mark.parametrize labels Apr 27, 2017
@nicoddemus
Copy link
Member

👍

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

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
Labels
good first issue easy issue that is friendly to new contributor topic: collection related to the collection phase topic: parametrize related to @pytest.mark.parametrize
Projects
None yet
Development

No branches or pull requests

2 participants