player nicer for missing parent Module objects for a collected function (bug triggered by oejskit)
--HG-- branch : trunk
This commit is contained in:
parent
fabd967595
commit
9910db2ca6
|
@ -175,6 +175,7 @@ def getexpression(item, keyword):
|
|||
if cls and hasattr(cls.obj, keyword):
|
||||
return getattr(cls.obj, keyword)
|
||||
mod = item.getparent(py.test.collect.Module)
|
||||
if mod:
|
||||
return getattr(mod.obj, keyword, None)
|
||||
|
||||
def evalexpression(item, keyword):
|
||||
|
|
|
@ -110,6 +110,9 @@ def test_getexpression(testdir):
|
|||
|
||||
assert getexpression(item2, 'just')
|
||||
|
||||
item2.parent = None
|
||||
assert not getexpression(item2, 'nada')
|
||||
|
||||
def test_evalexpression_cls_config_example(testdir):
|
||||
from _py.test.plugin.pytest_skipping import evalexpression
|
||||
item, = testdir.getitems("""
|
||||
|
|
Loading…
Reference in New Issue