Play nice with other plugins in conftest.py

Some plugins might create their own Item subclasses without
a `fixturenames` attribute. Discovered while taking pytest-flakes
for a spin.
This commit is contained in:
Bruno Oliveira 2015-04-19 17:11:29 -03:00
parent 6c97a4a6e0
commit 2d19708a41

View File

@ -107,7 +107,7 @@ def pytest_collection_modifyitems(items):
http://pytest.org/latest/plugins.html
"""
for item in items:
if 'qtbot' in item.fixturenames:
if 'qtbot' in getattr(item, 'fixturenames', ()):
item.add_marker('gui')