summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2019-09-17 08:03:56 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-09-17 08:03:56 +0000
commitd06fd33a9ab09e64446c7c90780f001a26e86d8e (patch)
tree62526daf82e0572062d17453c6415dc51ff5a868
parent8418b56746412b988a069354296f7294be7ff304 (diff)
parent6ad1761d2f1798db21497265ae2efaae8bdcb844 (diff)
downloadbuildstream-d06fd33a9ab09e64446c7c90780f001a26e86d8e.tar.gz
Merge branch 'juerg/artifactshare' into 'master'1.91.0
tests/testutils/artifactshare.py: Add SIGTERM handler to subprocess See merge request BuildStream/buildstream!1606
-rw-r--r--tests/testutils/artifactshare.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py
index f883b3d59..87b0808fe 100644
--- a/tests/testutils/artifactshare.py
+++ b/tests/testutils/artifactshare.py
@@ -1,6 +1,7 @@
import os
import shutil
import signal
+import sys
from collections import namedtuple
from contextlib import contextmanager
@@ -63,6 +64,11 @@ class ArtifactShare():
#
def run(self, q):
+ # Handle SIGTERM by calling sys.exit(0), which will raise a SystemExit exception,
+ # properly executing cleanup code in `finally` clauses and context managers.
+ # This is required to terminate buildbox-casd on SIGTERM.
+ signal.signal(signal.SIGTERM, lambda signalnum, frame: sys.exit(0))
+
try:
import pytest_cov
except ImportError: