Coverage for /home/ionel/open-source/pytest-cov/examples/adhoc-layout/.tox/py27/lib/python2.7/site-packages/_pytest/nose.py : 32%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" run test suites written for nose. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function
import sys
import six
from _pytest import python from _pytest import runner from _pytest import unittest from _pytest.config import hookimpl
def get_skip_exceptions(): skip_classes = set() for module_name in ("unittest", "unittest2", "nose"): mod = sys.modules.get(module_name) if hasattr(mod, "SkipTest"): skip_classes.add(mod.SkipTest) return tuple(skip_classes)
def pytest_runtest_makereport(item, call): # let's substitute the excinfo with a pytest.skip one call2 = runner.CallInfo.from_call( lambda: runner.skip(six.text_type(call.excinfo.value)), call.when ) call.excinfo = call2.excinfo
@hookimpl(trylast=True) def pytest_runtest_setup(item): # call module level setup if there is no object level one # XXX this implies we only call teardown when setup worked
def teardown_nose(item): # if hasattr(item.parent, '_nosegensetup'): # #call_optional(item._nosegensetup, 'teardown') # del item.parent._nosegensetup
def is_potential_nosetest(item): # extra check needed since we do not do nose style setup/teardown # on direct unittest style classes item, unittest.TestCaseFunction )
def call_optional(obj, name): # If there's any problems allow the exception to raise rather than # silently ignoring them method() return True |