mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-4080: unittest durations (#12271)
This commit is contained in:
parent
a0305c5fdf
commit
6883007a86
12 changed files with 227 additions and 34 deletions
|
@ -43,6 +43,7 @@ class TestResult(object):
|
|||
self.skipped = []
|
||||
self.expectedFailures = []
|
||||
self.unexpectedSuccesses = []
|
||||
self.collectedDurations = []
|
||||
self.shouldStop = False
|
||||
self.buffer = False
|
||||
self.tb_locals = False
|
||||
|
@ -157,6 +158,12 @@ class TestResult(object):
|
|||
"""Called when a test was expected to fail, but succeed."""
|
||||
self.unexpectedSuccesses.append(test)
|
||||
|
||||
def addDuration(self, test, elapsed):
|
||||
"""Called when a test finished to run, regardless of its outcome."""
|
||||
# support for a TextTestRunner using an old TestResult class
|
||||
if hasattr(self, "collectedDurations"):
|
||||
self.collectedDurations.append((test, elapsed))
|
||||
|
||||
def wasSuccessful(self):
|
||||
"""Tells whether or not this result was a success."""
|
||||
# The hasattr check is for test_result's OldResult test. That
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue