diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-01-22 17:22:06 -0800 |
---|---|---|
committer | Fabian Bieler <fabianbieler@fastmail.fm> | 2018-02-05 19:44:16 +0100 |
commit | 296fd8a5093a17cfaf9f2bfc5d17d9e2e694920a (patch) | |
tree | 9083ca413fe6ce382246835f54e37bb65e464c20 /unittests/framework | |
parent | 9aa249d938b8b5fafbe24aff365aa8bfdeaed573 (diff) |
framework: if a test with subtests crashes mark the offending subtest
This relies on the fact that subtests are guaranteed to be ordered to
mark the crashing subtest as such. This ensures that the correct status
will be propagated up the totals tree.
Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Diffstat (limited to 'unittests/framework')
-rw-r--r-- | unittests/framework/test/test_base.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/unittests/framework/test/test_base.py b/unittests/framework/test/test_base.py index 656d839f7..ad355b1d8 100644 --- a/unittests/framework/test/test_base.py +++ b/unittests/framework/test/test_base.py @@ -33,6 +33,8 @@ except ImportError: import pytest import six +from six.moves import range + from framework import dmesg from framework import log from framework import monitoring @@ -283,6 +285,40 @@ class TestTest(object): assert test.result.result is status.FAIL + def test_crash_subtest_before_start(self): + """A test for a test with a subtest, that crashes at the start + of the run. + """ + test = _Test(['foobar']) + test.result.returncode = -1 + for x in (str(y) for y in range(5)): + test.result.subtests[x] = status.NOTRUN + test.interpret_result() + + assert test.result.result is status.CRASH + assert test.result.subtests['0'] is status.CRASH + for x in (str(y) for y in range(1, 5)): + assert test.result.subtests[x] is status.NOTRUN + + def test_crash_subtest_mid(self): + """A test for a test with a subtest, that crashes in the middle + of the run. + """ + test = _Test(['foobar']) + test.result.returncode = -1 + for x in (str(y) for y in range(2)): + test.result.subtests[x] = status.PASS + for x in (str(y) for y in range(2, 5)): + test.result.subtests[x] = status.NOTRUN + test.interpret_result() + + assert test.result.result is status.CRASH + for x in (str(y) for y in range(2)): + assert test.result.subtests[x] is status.PASS + assert test.result.subtests['2'] is status.CRASH + for x in (str(y) for y in range(3, 5)): + assert test.result.subtests[x] is status.NOTRUN + class TestWindowResizeMixin(object): """Tests for the WindowResizeMixin class.""" |