summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-06 19:03:05 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-06 19:41:04 +0900
commitab666e53c3e2600ea99d46c8567b2f251bc49949 (patch)
treeaeea0cb7682645e6d21c66a9c179f8fa81116605
parenta32faf424b1eeaacecc0a156ff9fb4815571d827 (diff)
downloadbuildstream-ab666e53c3e2600ea99d46c8567b2f251bc49949.tar.gz
tests/testutils/runcli.py: Assert that buildstream actually exited.
Enhanced the error checking Result() methods to always assert that the CLI actually exited, there are no cases worth testing for where buildstream would be expected to exit on an unhandled exception.
-rw-r--r--tests/testutils/runcli.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py
index d1b8c019d..8ac3dd338 100644
--- a/tests/testutils/runcli.py
+++ b/tests/testutils/runcli.py
@@ -41,6 +41,7 @@ class Result():
self.exc_info = exc_info
self.output = output
self.stderr = stderr
+ self.unhandled_exception = False
# The last exception/error state is stored at exception
# creation time in BstError(), but this breaks down with
@@ -51,6 +52,14 @@ class Result():
# in the case that the exit code reported is 0 (success).
#
if self.exit_code != 0:
+
+ # Check if buildstream failed to handle an
+ # exception, topevel CLI exit should always
+ # be a SystemExit exception.
+ #
+ if not isinstance(exception, SystemExit):
+ self.unhandled_exception = True
+
self.exception = _get_last_exception()
self.task_error_domain, \
self.task_error_reason = _get_last_task_error()
@@ -73,6 +82,7 @@ class Result():
assert self.exit_code == 0, fail_message
assert self.exc is None, fail_message
assert self.exception is None, fail_message
+ assert self.unhandled_exception is False
# assert_main_error()
#
@@ -96,6 +106,7 @@ class Result():
assert self.exc is not None, fail_message
assert self.exception is not None, fail_message
assert isinstance(self.exception, BstError), fail_message
+ assert self.unhandled_exception is False
assert self.exception.domain == error_domain, fail_message
assert self.exception.reason == error_reason, fail_message
@@ -123,6 +134,7 @@ class Result():
assert self.exc is not None, fail_message
assert self.exception is not None, fail_message
assert isinstance(self.exception, BstError), fail_message
+ assert self.unhandled_exception is False
assert self.task_error_domain == error_domain, fail_message
assert self.task_error_reason == error_reason, fail_message