Issue #2383 - Show the correct error message when collect "parametrize" func with wrong args and add test for this case.

This commit is contained in:
Vitaly Lashmanov
2017-04-29 14:32:09 +03:00
parent d7d2249d99
commit 60b8339166
4 changed files with 28 additions and 1 deletions
+5 -1
View File
@@ -853,7 +853,11 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
for callspec in self._calls or [CallSpec2(self)]:
elements = zip(ids, argvalues, newkeywords, count())
for a_id, valset, keywords, param_index in elements:
assert len(valset) == len(argnames)
if len(valset) != len(argnames):
raise ValueError(
'In "parametrize" the number of values ({0}) must be '
'equal to the number of names ({1})'.format(
valset, argnames))
newcallspec = callspec.copy(self)
newcallspec.setmulti(valtypes, argnames, valset, a_id,
keywords, scopenum, param_index)