summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-04 21:03:37 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-10 19:29:59 +0900
commitc986ab45d9325dbe5dd242291e40d157f238eea9 (patch)
tree348f57f97834e54c87f8fc3fc5920db79801a81d
parent41794f825f2ebb2055d6eded4821403352d5c9fd (diff)
downloadbuildstream-c986ab45d9325dbe5dd242291e40d157f238eea9.tar.gz
tests/testutils/runcli.py: Provide the last raised exception in the result
-rw-r--r--tests/format/__init__.py0
-rw-r--r--tests/testutils/runcli.py15
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/format/__init__.py b/tests/format/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/format/__init__.py
diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py
index 86cc8f71c..963af2fe5 100644
--- a/tests/testutils/runcli.py
+++ b/tests/testutils/runcli.py
@@ -9,6 +9,19 @@ import pytest
from buildstream._frontend.main import cli as bst_cli
from buildstream import _yaml
+# Special private exception accessor, for test case purposes
+from buildstream.exceptions import _get_last_exception
+
+
+# Wrapper for the click.testing result
+class Result():
+
+ def __init__(self, result):
+ self.exit_code = result.exit_code
+ self.output = result.output
+ self.exception = _get_last_exception()
+ self.result = result
+
class Cli():
@@ -87,7 +100,7 @@ class Cli():
if result.exc_info and result.exc_info[0] != SystemExit:
traceback.print_exception(*result.exc_info)
- return result
+ return Result(result)
# Fetch an element state by name by
# invoking bst show on the project with the CLI