Skip to content

TypeError in python.py:_getobj when having a TestCase namedtuple #1579

Closed
@languitar

Description

@languitar

parametrizing a test function fails in case the argument for the function is only an empty list:

@pytest.mark.parametrize('test_cases', [
    ([], )
])
def test_read_write_roundtrip(test_cases):
    pass

fails with:

/media/local_data/jwienke/miniconda2/envs/monitoring/lib/python2.7/site-packages/_pytest/runner.py:150: in __init__
    self.result = func()
/media/local_data/jwienke/miniconda2/envs/monitoring/lib/python2.7/site-packages/_pytest/main.py:435: in _memocollect
    return self._memoizedcall('_collected', lambda: list(self.collect()))
/media/local_data/jwienke/miniconda2/envs/monitoring/lib/python2.7/site-packages/_pytest/main.py:315: in _memoizedcall
    res = function()
/media/local_data/jwienke/miniconda2/envs/monitoring/lib/python2.7/site-packages/_pytest/main.py:435: in <lambda>
    return self._memoizedcall('_collected', lambda: list(self.collect()))
/media/local_data/jwienke/miniconda2/envs/monitoring/lib/python2.7/site-packages/_pytest/python.py:685: in collect
    self.session._fixturemanager.parsefactories(self)
/media/local_data/jwienke/miniconda2/envs/monitoring/lib/python2.7/site-packages/_pytest/python.py:1969: in parsefactories
    holderobj = node_or_obj.obj
/media/local_data/jwienke/miniconda2/envs/monitoring/lib/python2.7/site-packages/_pytest/python.py:351: in fget
    self._obj = obj = self._getobj()
/media/local_data/jwienke/miniconda2/envs/monitoring/lib/python2.7/site-packages/_pytest/python.py:681: in _getobj
    obj = self.parent.obj()
E   TypeError: __new__() takes exactly 4 arguments (1 given)
astroid (1.4.4)
backports.shutil-get-terminal-size (1.0.0)
backports.ssl-match-hostname (3.4.0.2)
coverage (4.1)
cycler (0.10.0)
decorator (4.0.9)
enum34 (1.1.3)
futures (3.0.5)
greenlet (0.4.9)
ipython (4.2.0)
ipython-genutils (0.1.0)
jenkinsapi (0.2.30)
junit-xml (1.6)
lazy-object-proxy (1.2.1)
loggerbyclass (0.2.0)
logilab-common (1.0.2)
matplotlib (1.5.1)
monitoring-lib (0.1.0)
msgpack-python (0.4.7)
neovim (0.1.7)
nose (1.3.7)
numexpr (2.5.2)
numpy (1.11.0)
pandas (0.18.1)
path.py (0.0.0)
patsy (0.4.1)
pep8 (1.7.0)
perfmonvalidation (0.3)
pexpect (4.0.1)
pickleshare (0.5)
pip (7.1.2)
protobuf (2.5.0)
ptyprocess (0.5)
py (1.4.31)
pybtex (0.19)
pycairo (1.10.0)
pylint (1.5.4)
pyparsing (2.1.1)
pytest (2.9.1)
python-dateutil (2.5.2)
pytz (2016.3)
requests (2.10.0)
rsb-python (0.13.0)
rsbag-python (0.13.1)
rst (0.13.0)
rstsandbox (0.13.0)
rststable (0.13.5)
scikit-learn (0.17.1)
scipy (0.17.1)
seaborn (0.7.0)
setuptools (20.7.0)
simplegeneric (0.8.1)
singledispatch (3.4.0.3)
six (1.10.0)
statsmodels (0.6.1)
tables (3.2.2)
traitlets (4.2.1)
trollius (2.1)
websocket-client (0.34.0)
wheel (0.29.0)
wrapt (1.10.6)

Running on ubuntu trusty 64 bit with miniconda python:

Python 2.7.11 :: Continuum Analytics, Inc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: criticalgrave problem or usability issue that affects lots of usersstatus: help wanteddevelopers would like help from experts on this topictopic: collectionrelated to the collection phasetype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions