fix linting issues
This commit is contained in:
parent
06a49338b2
commit
be401bc2f8
|
@ -22,7 +22,7 @@ class OutcomeException(BaseException):
|
||||||
if isinstance(val, bytes):
|
if isinstance(val, bytes):
|
||||||
val = py._builtin._totext(val, errors='replace')
|
val = py._builtin._totext(val, errors='replace')
|
||||||
return val
|
return val
|
||||||
return "<%s instance>" %(self.__class__.__name__,)
|
return "<%s instance>" % (self.__class__.__name__,)
|
||||||
__str__ = __repr__
|
__str__ = __repr__
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ class Exit(KeyboardInterrupt):
|
||||||
|
|
||||||
# exposed helper methods
|
# exposed helper methods
|
||||||
|
|
||||||
|
|
||||||
def exit(msg):
|
def exit(msg):
|
||||||
""" exit testing process as if KeyboardInterrupt was triggered. """
|
""" exit testing process as if KeyboardInterrupt was triggered. """
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
|
@ -87,7 +88,6 @@ def fail(msg="", pytrace=True):
|
||||||
fail.Exception = Failed
|
fail.Exception = Failed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class XFailed(fail.Exception):
|
class XFailed(fail.Exception):
|
||||||
""" raised from an explicit call to pytest.xfail() """
|
""" raised from an explicit call to pytest.xfail() """
|
||||||
|
|
||||||
|
@ -101,7 +101,6 @@ def xfail(reason=""):
|
||||||
xfail.Exception = XFailed
|
xfail.Exception = XFailed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def importorskip(modname, minversion=None):
|
def importorskip(modname, minversion=None):
|
||||||
""" return imported module if it has at least "minversion" as its
|
""" return imported module if it has at least "minversion" as its
|
||||||
__version__ attribute. If no minversion is specified the a skip
|
__version__ attribute. If no minversion is specified the a skip
|
||||||
|
@ -109,7 +108,7 @@ def importorskip(modname, minversion=None):
|
||||||
"""
|
"""
|
||||||
import warnings
|
import warnings
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
compile(modname, '', 'eval') # to catch syntaxerrors
|
compile(modname, '', 'eval') # to catch syntaxerrors
|
||||||
should_skip = False
|
should_skip = False
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
|
@ -123,7 +122,7 @@ def importorskip(modname, minversion=None):
|
||||||
# Do not raise chained exception here(#1485)
|
# Do not raise chained exception here(#1485)
|
||||||
should_skip = True
|
should_skip = True
|
||||||
if should_skip:
|
if should_skip:
|
||||||
raise Skipped("could not import %r" %(modname,), allow_module_level=True)
|
raise Skipped("could not import %r" % (modname,), allow_module_level=True)
|
||||||
mod = sys.modules[modname]
|
mod = sys.modules[modname]
|
||||||
if minversion is None:
|
if minversion is None:
|
||||||
return mod
|
return mod
|
||||||
|
@ -136,6 +135,6 @@ def importorskip(modname, minversion=None):
|
||||||
"pkg_resources to parse version strings." % (modname,),
|
"pkg_resources to parse version strings." % (modname,),
|
||||||
allow_module_level=True)
|
allow_module_level=True)
|
||||||
if verattr is None or pv(verattr) < pv(minversion):
|
if verattr is None or pv(verattr) < pv(minversion):
|
||||||
raise Skipped("module %r has __version__ %r, required is: %r" %(
|
raise Skipped("module %r has __version__ %r, required is: %r" % (
|
||||||
modname, verattr, minversion), allow_module_level=True)
|
modname, verattr, minversion), allow_module_level=True)
|
||||||
return mod
|
return mod
|
||||||
|
|
|
@ -11,6 +11,7 @@ import warnings
|
||||||
from _pytest.fixtures import yield_fixture
|
from _pytest.fixtures import yield_fixture
|
||||||
from _pytest.outcomes import fail
|
from _pytest.outcomes import fail
|
||||||
|
|
||||||
|
|
||||||
@yield_fixture
|
@yield_fixture
|
||||||
def recwarn():
|
def recwarn():
|
||||||
"""Return a WarningsRecorder instance that provides these methods:
|
"""Return a WarningsRecorder instance that provides these methods:
|
||||||
|
|
|
@ -13,6 +13,7 @@ from _pytest.outcomes import skip, Skipped, TEST_OUTCOME
|
||||||
#
|
#
|
||||||
# pytest plugin hooks
|
# pytest plugin hooks
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
group = parser.getgroup("terminal reporting", "reporting", after="general")
|
group = parser.getgroup("terminal reporting", "reporting", after="general")
|
||||||
group.addoption('--durations',
|
group.addoption('--durations',
|
||||||
|
@ -505,7 +506,3 @@ def collect_one_node(collector):
|
||||||
if call and check_interactive_exception(call, rep):
|
if call and check_interactive_exception(call, rep):
|
||||||
ihook.pytest_exception_interact(node=collector, call=call, report=rep)
|
ihook.pytest_exception_interact(node=collector, call=call, report=rep)
|
||||||
return rep
|
return rep
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ def pytest_configure(config):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MarkEvaluator:
|
class MarkEvaluator:
|
||||||
def __init__(self, item, name):
|
def __init__(self, item, name):
|
||||||
self.item = item
|
self.item = item
|
||||||
|
|
|
@ -461,7 +461,6 @@ def test_outcomeexception_passes_except_Exception():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_pytest_exit():
|
def test_pytest_exit():
|
||||||
try:
|
try:
|
||||||
pytest.exit("hello")
|
pytest.exit("hello")
|
||||||
|
|
Loading…
Reference in New Issue