summaryrefslogtreecommitdiff
path: root/tests/pipeline/unhandled.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pipeline/unhandled.py')
-rw-r--r--tests/pipeline/unhandled.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/pipeline/unhandled.py b/tests/pipeline/unhandled.py
new file mode 100644
index 000000000..114900d36
--- /dev/null
+++ b/tests/pipeline/unhandled.py
@@ -0,0 +1,35 @@
+import os
+import pytest
+import re
+import subprocess
+import sys
+
+from buildstream._exceptions import ErrorDomain
+from tests.testutils.runcli import cli
+
+DATA_DIR = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ 'unhandled-error',
+)
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_load_simple(cli, datafiles, tmpdir):
+ basedir = os.path.join(datafiles.dirname, datafiles.basename)
+
+ process = subprocess.Popen(['bst', 'fetch', 'error.bst'],
+ cwd=basedir, stderr=subprocess.PIPE)
+ try:
+ (stdout, stderr) = process.communicate()
+ except TimeoutExpired:
+ proc.kill()
+ (stdout, stderr) = process.communicate()
+
+ # The process should have caught the exception and explicitly exited with code -1
+ assert process.returncode == 255
+ assert stderr is not None
+
+ expected_error = "BUG\s+preflighterror: Unsatisfied requirements in preflight, raising this error"
+
+ match = re.search(expected_error, stderr.decode("utf-8"))
+ assert match is not None