summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2016-05-09 14:37:14 -0700
committerDylan Baker <dylan@pnwbakers.com>2016-05-16 15:12:56 -0700
commit62857f092b7a0387bac1572b5193aa0f13c1226e (patch)
treef1ef29194907b8c33d38ccd2a03cc29adc4ac233
parent3bb263d6f47166c19aecf8e1978fcc7fd4c9c620 (diff)
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 <dylanx.c.baker@intel.com> reviewed-by: Brian Paul <brianp@vmware.com> Tested-by: Brian Paul <brianp@vmware.com>
-rw-r--r--unittests/results_tests.py13
1 files changed, 13 insertions, 0 deletions
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')