newlines
This commit is contained in:
parent
9e57954b03
commit
213dbe7a5f
|
@ -7,12 +7,14 @@ import py
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest.mark import MarkInfo
|
from _pytest.mark import MarkInfo
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
group = parser.getgroup("general")
|
group = parser.getgroup("general")
|
||||||
group.addoption('--runxfail',
|
group.addoption('--runxfail',
|
||||||
action="store_true", dest="runxfail", default=False,
|
action="store_true", dest="runxfail", default=False,
|
||||||
help="run tests even if they are marked xfail")
|
help="run tests even if they are marked xfail")
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
if config.option.runxfail:
|
if config.option.runxfail:
|
||||||
old = pytest.xfail
|
old = pytest.xfail
|
||||||
|
@ -39,18 +41,22 @@ def pytest_configure(config):
|
||||||
"See http://pytest.org/latest/skipping.html"
|
"See http://pytest.org/latest/skipping.html"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def pytest_namespace():
|
def pytest_namespace():
|
||||||
return dict(xfail=xfail)
|
return dict(xfail=xfail)
|
||||||
|
|
||||||
|
|
||||||
class XFailed(pytest.fail.Exception):
|
class XFailed(pytest.fail.Exception):
|
||||||
""" raised from an explicit call to pytest.xfail() """
|
""" raised from an explicit call to pytest.xfail() """
|
||||||
|
|
||||||
|
|
||||||
def xfail(reason=""):
|
def xfail(reason=""):
|
||||||
""" xfail an executing test or setup functions with the given reason."""
|
""" xfail an executing test or setup functions with the given reason."""
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
raise XFailed(reason)
|
raise XFailed(reason)
|
||||||
xfail.Exception = XFailed
|
xfail.Exception = XFailed
|
||||||
|
|
||||||
|
|
||||||
class MarkEvaluator(object):
|
class MarkEvaluator(object):
|
||||||
def __init__(self, item, name):
|
def __init__(self, item, name):
|
||||||
self.item = item
|
self.item = item
|
||||||
|
|
|
@ -4,6 +4,7 @@ import sys
|
||||||
from _pytest.skipping import MarkEvaluator, folded_skips, pytest_runtest_setup
|
from _pytest.skipping import MarkEvaluator, folded_skips, pytest_runtest_setup
|
||||||
from _pytest.runner import runtestprotocol
|
from _pytest.runner import runtestprotocol
|
||||||
|
|
||||||
|
|
||||||
class TestEvaluator(object):
|
class TestEvaluator(object):
|
||||||
def test_no_marker(self, testdir):
|
def test_no_marker(self, testdir):
|
||||||
item = testdir.getitem("def test_func(): pass")
|
item = testdir.getitem("def test_func(): pass")
|
||||||
|
|
Loading…
Reference in New Issue