New issue 751: py.test can't multiple parametrize with ids if it parametrize 
class with two or more test methods
https://bitbucket.org/pytest-dev/pytest/issue/751/pytest-cant-multiple-parametrize-with-ids

sergey chipiga:

Code example

%%python
import pytest

@pytest.mark.parametrize('x', [0], ids=['c'])
@pytest.mark.parametrize('y', [0, 1], ids=['a', 'b'])
class Test(object):

    def test1(self, x, y):
        pass

    def test2(self, x, y):
        pass
%%

stack trace

%%
py.test proba.py --collect-only
============================================================================== 
test session starts 
===============================================================================
platform darwin -- Python 2.7.9 -- py-1.4.26 -- pytest-2.7.0
rootdir: /Users/svchipiga/lira/tmp, inifile: 
collected 0 items / 1 errors 

=====================================================================================
 ERRORS 
=====================================================================================
___________________________________________________________________________ 
ERROR collecting proba.py 
____________________________________________________________________________
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/runner.py:149:
 in __init__
    self.result = func()
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/main.py:437:
 in _memocollect
    return self._memoizedcall('_collected', lambda: list(self.collect()))
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/main.py:314:
 in _memoizedcall
    res = function()
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/main.py:437:
 in <lambda>
    return self._memoizedcall('_collected', lambda: list(self.collect()))
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/python.py:563:
 in collect
    return super(Instance, self).collect()
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/python.py:355:
 in collect
    res = self.makeitem(name, obj)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/python.py:367:
 in makeitem
    collector=self, name=name, obj=obj)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/core.py:521:
 in __call__
    return self._docall(self.methods, kwargs)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/core.py:528:
 in _docall
    firstresult=self.firstresult).execute()
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/core.py:393:
 in execute
    return wrapped_call(method(*args), self.execute)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/core.py:109:
 in wrapped_call
    wrap_controller.send(call_outcome)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/python.py:245:
 in pytest_pycollect_makeitem
    res = list(collector._genfunctions(name, obj))
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/python.py:384:
 in _genfunctions
    self.ihook.pytest_generate_tests.callextra(methods, metafunc=metafunc)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/core.py:524:
 in callextra
    return self._docall(self.methods + methods, kwargs)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/core.py:528:
 in _docall
    firstresult=self.firstresult).execute()
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/core.py:394:
 in execute
    res = method(*args)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/python.py:154:
 in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_pytest/python.py:859:
 in parametrize
    len(argvalues), len(ids)))
E   ValueError: 2 tests specified with 1 ids
%%

Responsible: hpk42
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to