diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2018-05-31 17:54:09 +0100 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.co.uk> | 2018-06-01 11:19:20 +0100 |
commit | 93f53226e7c2868eba56fc01688480e77b2e8b13 (patch) | |
tree | 3f7f7c7eb9c613416aded28c25145e1cd1c5418a | |
parent | 9e0b0ffa4b3724d5b4967cd41c34baa2f4a1f312 (diff) | |
download | buildstream-tlater/context-trailing-slash.tar.gz |
tests/context/context.py: Test setting XDG_CACHE_HOMEtlater/context-trailing-slash
-rw-r--r-- | tests/context/context.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/context/context.py b/tests/context/context.py index 0dc6c588b..35428105b 100644 --- a/tests/context/context.py +++ b/tests/context/context.py @@ -47,6 +47,23 @@ def test_context_load(context_fixture): assert(context.logdir == os.path.join(cache_home, 'buildstream', 'logs')) +# Assert that a changed XDG_CACHE_HOME doesn't cause issues +def test_context_load_envvar(context_fixture): + os.environ['XDG_CACHE_HOME'] = '/some/path/' + + context = context_fixture['context'] + assert(isinstance(context, Context)) + + context.load(config=os.devnull) + assert(context.sourcedir == os.path.join('/', 'some', 'path', 'buildstream', 'sources')) + assert(context.builddir == os.path.join('/', 'some', 'path', 'buildstream', 'build')) + assert(context.artifactdir == os.path.join('/', 'some', 'path', 'buildstream', 'artifacts')) + assert(context.logdir == os.path.join('/', 'some', 'path', 'buildstream', 'logs')) + + # Reset the environment variable + del os.environ['XDG_CACHE_HOME'] + + # Test that values in a user specified config file # override the defaults @pytest.mark.datafiles(os.path.join(DATA_DIR)) |