Skip to content

pytest >= 3.2.4 raises an exception when pytest.mark.xfail() is used as a fixture param #2942

@santa01

Description

@santa01

I have a conftest.py with a parametrized fixture in a test subdir (see a minimal example attached) with one of the params declared as pytest.mark.xfail(). This puppy worked with pytest == 3.2.3 but after the pytest update to 3.2.4 (3.2.5 also affected) I get:

/tmp/pytest-rtpproxy/lib/python2.7/site-packages/py/_path/common.py:372: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/tmp/pytest-rtpproxy/lib/python2.7/site-packages/py/_path/common.py:411: in gen
    if p.check(dir=1) and (rec is None or rec(p))])
/tmp/pytest-rtpproxy/lib/python2.7/site-packages/_pytest/main.py:737: in _recurse
    ihook = self.gethookproxy(path)
/tmp/pytest-rtpproxy/lib/python2.7/site-packages/_pytest/main.py:641: in gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
/tmp/pytest-rtpproxy/lib/python2.7/site-packages/_pytest/config.py:356: in _getconftestmodules
    mod = self._importconftest(conftestpath)
/tmp/pytest-rtpproxy/lib/python2.7/site-packages/_pytest/config.py:381: in _importconftest
    raise ConftestImportFailure(conftestpath, sys.exc_info())
E   ConftestImportFailure: ValueError('need more than 1 value to unpack',)
E     File "/tmp/pytest-rtpproxy/lib/python2.7/site-packages/_pytest/assertion/rewrite.py", line 212, in load_module
E       py.builtin.exec_(co, mod.__dict__)
E     File "/tmp/pytest-rtpproxy/lib/python2.7/site-packages/py/_builtin.py", line 221, in exec_
E       exec2(obj, globals, locals)
E     File "<string>", line 7, in exec2
E     File "/home/porta-one/repos/rtpproxy/test/ft/ft1_dummy/conftest.py", line 3, in <module>
E       @pytest.fixture(params = ['OK', pytest.mark.xfail('FAIL')])
E     File "/tmp/pytest-rtpproxy/lib/python2.7/site-packages/_pytest/mark.py", line 264, in __getattr__
E       self._check(name)
E     File "/tmp/pytest-rtpproxy/lib/python2.7/site-packages/_pytest/mark.py", line 275, in _check
E       marker, _ = line.split(":", 1)

Please note that no exception is raised if I move conftest.py to the test root dir.

To setup the virtualenv and start the tests I do:

> virtualenv --system-site-packages /tmp/somewhere
/tmp/somewhere/bin/pip install pytest pytest-xdist pytest-timeout
/tmp/somewhere/bin/py.test -s

Minimal example attached: ft.zip

Virtualenv package list attached: virtualenv.txt

The virtualenv is deployed with:

> /usr/bin/python 
Python 2.7.5 (default, May 29 2017, 20:42:36) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2

> yum info python
Version     : 2.7.5
Release     : 58.0.1.el7

> yum info python-virtualenv
Version     : 1.10.1
Release     : 4.el7

OS: Red Hat Enterprise Linux Server release 7.4 (Maipo)

edit by @nicoddemus: formatting

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: marksrelated to marks, either the general marks or builtintype: 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