diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-07-15 14:39:17 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-07-24 12:27:10 +0000 |
commit | 3fcd62c32fdad8e107c5b1fd8cef56a00dcac435 (patch) | |
tree | 8c80e1006ca688ec305da7abf2eb16aebd900ba4 | |
parent | 385aeca45de981254f2e8d7b18221917e4abda51 (diff) | |
download | buildstream-3fcd62c32fdad8e107c5b1fd8cef56a00dcac435.tar.gz |
_context, cascache: mv BST_TEST_SUITE to Context
Store the result of checking for BST_TEST_SUITE in the environment into
the Context. This feels less weird than checking the environment every
time. Note that this cannot replace every instance, as not everything
should have access to the Context.
-rw-r--r-- | src/buildstream/_cas/cascache.py | 2 | ||||
-rw-r--r-- | src/buildstream/_context.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index 27c332920..dbdfa41a8 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -1204,7 +1204,7 @@ class CASQuota: # This acts as the minimum size of cache_quota and also # is taken from the user requested cache_quota. # - if 'BST_TEST_SUITE' in os.environ: + if self.context.is_running_in_test_suite: self._cache_quota_headroom = 0 else: self._cache_quota_headroom = 2e9 diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py index d3c6ef47c..c18f9426d 100644 --- a/src/buildstream/_context.py +++ b/src/buildstream/_context.py @@ -49,6 +49,10 @@ class Context(): def __init__(self): + # Whether we are running as part of a test suite. This is only relevant + # for developing BuildStream itself. + self.is_running_in_test_suite = 'BST_TEST_SUITE' in os.environ + # Filename indicating which configuration file was used, or None for the defaults self.config_origin = None |