Fix case where skip is assigned to as an attribute directly
This commit is contained in:
parent
f144666f8b
commit
ad0b8e31b8
|
@ -5,6 +5,7 @@ import traceback
|
|||
|
||||
import py
|
||||
import pytest
|
||||
from _pytest.mark import MarkInfo
|
||||
|
||||
def pytest_addoption(parser):
|
||||
group = parser.getgroup("general")
|
||||
|
@ -148,14 +149,15 @@ class MarkEvaluator:
|
|||
@pytest.hookimpl(tryfirst=True)
|
||||
def pytest_runtest_setup(item):
|
||||
eval_skipif = MarkEvaluator(item, 'skipif')
|
||||
eval_skip = MarkEvaluator(item, 'skip')
|
||||
|
||||
if eval_skipif.istrue():
|
||||
item._evalskip = eval_skipif
|
||||
pytest.skip(eval_skipif.getexplanation())
|
||||
elif eval_skip.istrue():
|
||||
item._evalskip = eval_skip
|
||||
pytest.skip(eval_skip.getexplanation())
|
||||
elif isinstance(item.keywords.get('skip'), MarkInfo):
|
||||
eval_skip = MarkEvaluator(item, 'skip')
|
||||
if eval_skip.istrue():
|
||||
item._evalskip = eval_skip
|
||||
pytest.skip(eval_skip.getexplanation())
|
||||
|
||||
item._evalxfail = MarkEvaluator(item, 'xfail')
|
||||
check_xfail_no_run(item)
|
||||
|
|
Loading…
Reference in New Issue