summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2019-07-10 18:00:11 +0100
committerDarius Makovsky <traveltissues@protonmail.com>2019-07-18 10:20:01 +0100
commitdb57101b66629d3c3ac0af76354042eddfc3fff9 (patch)
treee34b58156801ba5894425972812d8847b52e949b
parentef4cc3f2ff5c134d5fce500398158be2a7baf81a (diff)
downloadbuildstream-db57101b66629d3c3ac0af76354042eddfc3fff9.tar.gz
Mock BST_TEST_SUITE env when running update.py
If this is not present in the env the cli will throw an exception closes #1074
-rwxr-xr-xtests/cachekey/update.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/cachekey/update.py b/tests/cachekey/update.py
index 68016ed6a..e6f4198ef 100755
--- a/tests/cachekey/update.py
+++ b/tests/cachekey/update.py
@@ -13,6 +13,7 @@
#
import os
import tempfile
+from unittest import mock
from buildstream.testing.runcli import Cli
# This weird try / except is needed, because this will be imported differently
@@ -67,4 +68,9 @@ def update_keys():
if __name__ == '__main__':
- update_keys()
+ # patch the environment BST_TEST_SUITE value to something if it's not
+ # present. This avoids an exception thrown at the cli level
+ bst = 'BST_TEST_SUITE'
+ mock_bst = os.environ.get(bst, 'True')
+ with mock.patch.dict(os.environ, {**os.environ, bst: mock_bst}):
+ update_keys()