Coverage for .tox/testcoverage/lib/python2.7/site-packages/_pytest/nose : 28%

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. """
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)
# let's substitute the excinfo with a pytest.skip one call2 = call.__class__(lambda: pytest.skip(str(call.excinfo.value)), call.when) call.excinfo = call2.excinfo
def pytest_runtest_setup(item): if isinstance(item.parent, pytest.Generator): gen = item.parent if not hasattr(gen, '_nosegensetup'): call_optional(gen.obj, 'setup') if isinstance(gen.parent, pytest.Instance): call_optional(gen.parent.obj, 'setup') gen._nosegensetup = True if not call_optional(item.obj, 'setup'): # call module level setup if there is no object level one call_optional(item.parent.obj, 'setup') #XXX this implies we only call teardown when setup worked item.session._setupstate.addfinalizer((lambda: teardown_nose(item)), item)
if is_potential_nosetest(item): if not call_optional(item.obj, 'teardown'): call_optional(item.parent.obj, 'teardown') #if hasattr(item.parent, '_nosegensetup'): # #call_optional(item._nosegensetup, 'teardown') # del item.parent._nosegensetup
call_optional(collector.obj, 'setup')
# extra check needed since we do not do nose style setup/teardown # on direct unittest style classes not isinstance(item, unittest.TestCaseFunction)
method = getattr(obj, name, None) isfixture = hasattr(method, "_pytestfixturefunction") if method is not None and not isfixture and py.builtin.callable(method): # If there's any problems allow the exception to raise rather than # silently ignoring them method() return True |