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

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

Closed
santa01 opened this issue Nov 22, 2017 · 2 comments
Labels
topic: marks related to marks, either the general marks or builtin type: bug problem that needs to be addressed

Comments

@santa01
Copy link

santa01 commented Nov 22, 2017

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

@nicoddemus nicoddemus added topic: marks related to marks, either the general marks or builtin type: bug problem that needs to be addressed labels Nov 22, 2017
@nicoddemus
Copy link
Member

Thanks @santa01 for the report!

I think this was introduced by #2856 and #2867. Perhaps @Perlence would like to take a look?

@Perlence
Copy link
Contributor

@nicoddemus Sure, let me see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: marks related to marks, either the general marks or builtin type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

3 participants