summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/runner.py
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2010-02-23 17:00:53 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2010-02-23 17:00:53 (GMT)
commitd99ef9a9df093d3443996725cd9dcac5f113f176 (patch)
treea085a6242883b616fdbed2c61cdcb84df1bb6140 /Lib/unittest/runner.py
parentcf80f04b16e25d05f60ca9a2e94cbf742b01d47a (diff)
downloadcpython-d99ef9a9df093d3443996725cd9dcac5f113f176.zip
cpython-d99ef9a9df093d3443996725cd9dcac5f113f176.tar.gz
cpython-d99ef9a9df093d3443996725cd9dcac5f113f176.tar.bz2
unittest.TestResult can now be used with the TextTestRunner. TextTestRunner compatible with old TestResult objects.
Diffstat (limited to 'Lib/unittest/runner.py')
-rw-r--r--Lib/unittest/runner.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/unittest/runner.py b/Lib/unittest/runner.py
index cbec296..2fe01f6 100644
--- a/Lib/unittest/runner.py
+++ b/Lib/unittest/runner.py
@@ -148,15 +148,22 @@ class TextTestRunner(object):
stopTime = time.time()
timeTaken = stopTime - startTime
result.printErrors()
- self.stream.writeln(result.separator2)
+ if hasattr(result, 'separator2'):
+ self.stream.writeln(result.separator2)
run = result.testsRun
self.stream.writeln("Ran %d test%s in %.3fs" %
(run, run != 1 and "s" or "", timeTaken))
self.stream.writeln()
- results = map(len, (result.expectedFailures,
- result.unexpectedSuccesses,
- result.skipped))
- expectedFails, unexpectedSuccesses, skipped = results
+
+ expectedFails = unexpectedSuccesses = skipped = 0
+ try:
+ results = map(len, (result.expectedFailures,
+ result.unexpectedSuccesses,
+ result.skipped))
+ expectedFails, unexpectedSuccesses, skipped = results
+ except AttributeError:
+ pass
+
infos = []
if not result.wasSuccessful():
self.stream.write("FAILED")