_pytest.unittest module

discovery and running of std-library “unittest” style tests.

pytest_pycollect_makeitem(collector, name, obj)[source]
class UnitTestCase(*k, **kw)[source]

Bases: _pytest.python.Class

nofuncargs = True
for ... in collect()[source]

returns a list of children (items and collectors) for this collection node.

_inject_setup_teardown_fixtures(cls)[source]

Injects a hidden auto-use fixture to invoke setUpClass/setup_method and corresponding teardown functions (#517)

_make_xunit_fixture(obj, setup_name, teardown_name, scope, pass_self)[source]
class TestCaseFunction(*k, **kw)[source]

Bases: _pytest.python.Function

nofuncargs = True
_excinfo = None
_testcase = None
setup()[source]
teardown()[source]
startTest(testcase)[source]
_addexcinfo(rawexcinfo)[source]
addError(testcase, rawexcinfo)[source]
addFailure(testcase, rawexcinfo)[source]
addSkip(testcase, reason)[source]
addExpectedFailure(testcase, rawexcinfo, reason='')[source]
addUnexpectedSuccess(testcase, reason='')[source]
addSuccess(testcase)[source]
stopTest(testcase)[source]
_expecting_failure(test_method)bool[source]

Return True if the given unittest method (or the entire class) is marked with @expectedFailure

runtest()[source]

execute the underlying test function.

_prunetraceback(excinfo)[source]
pytest_runtest_makereport(item, call)[source]
for ... in pytest_runtest_protocol(item)[source]
check_testcase_implements_trial_reporter(done=[])[source]