MCPcopy Index your code
hub / github.com/python/cpython / _run_suite

Function _run_suite

Lib/test/libregrtest/single.py:78–106  ·  view source on GitHub ↗

Run tests from a unittest.TestSuite-derived class.

(suite)

Source from the content-addressed store, hash-verified

76 suite._tests = newtests
77
78def _run_suite(suite):
79 """Run tests from a unittest.TestSuite-derived class."""
80 runner = get_test_runner(sys.stdout,
81 verbosity=support.verbose,
82 capture_output=(support.junit_xml_list is not None))
83
84 result = runner.run(suite)
85
86 if support.junit_xml_list is not None:
87 import xml.etree.ElementTree as ET
88 xml_elem = result.get_xml_element()
89 xml_str = ET.tostring(xml_elem).decode('ascii')
90 support.junit_xml_list.append(xml_str)
91
92 if not result.testsRun and not result.skipped and not result.errors:
93 raise support.TestDidNotRun
94 if not result.wasSuccessful():
95 stats = TestStats.from_unittest(result)
96 if len(result.errors) == 1 and not result.failures:
97 err = result.errors[0][1]
98 elif len(result.failures) == 1 and not result.errors:
99 err = result.failures[0][1]
100 else:
101 err = "multiple errors occurred"
102 if not support.verbose: err += "; run in verbose mode for details"
103 errors = [(str(tc), exc_str) for tc, exc_str in result.errors]
104 failures = [(str(tc), exc_str) for tc, exc_str in result.failures]
105 raise support.TestFailedWithDetails(err, errors, failures, stats=stats)
106 return result
107
108
109def regrtest_runner(result: TestResult, test_func, runtests: RunTests) -> None:

Callers 1

run_unittestFunction · 0.85

Calls 8

get_test_runnerFunction · 0.85
strFunction · 0.85
get_xml_elementMethod · 0.80
from_unittestMethod · 0.80
runMethod · 0.45
decodeMethod · 0.45
appendMethod · 0.45
wasSuccessfulMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…