From 62857f092b7a0387bac1572b5193aa0f13c1226e Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 9 May 2016 14:37:14 -0700 Subject: unittests: Add a test case to ensure subtests don't mask crashes Currently a test can crash, but if some subtests have a better status then the status will be the worst of the subtests. This isn't correct behavior because 'crash' is a framework generated status, not a status that the runner itself generates. Signed-off-by: Dylan Baker reviewed-by: Brian Paul Tested-by: Brian Paul --- unittests/results_tests.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/unittests/results_tests.py b/unittests/results_tests.py index 7cdb849ff..466f1e426 100644 --- a/unittests/results_tests.py +++ b/unittests/results_tests.py @@ -185,6 +185,19 @@ def test_TestResult_result_getter_subtests(): nt.eq_(test.result, 'incomplete') +def test_TestResult_result_getters_subtests_crash(): + """results.TestResult.result.__get__: doesn't mask crashes. + + Crash is somewhat unique in that subtests can run and pass, but then the + test can crash before all subtests have been run. + + """ + test = results.TestResult('crash') + test.subtests['a'] = 'pass' + test.subtests['b'] = 'skip' + nt.eq_(test.result, 'crash') + + def test_TestResult_result_setter(): """results.TestResult.result: setter makes the result a status""" test = results.TestResult('pass') -- cgit v1.2.3