tests load user's configuration
I stumbled upon this because I had setup a demo with a config file which relocated my environment, and this caused tests to break when running tests on master
with the following error:
self = <buildstream._context.Context object at 0x7f5310deb978>, config = '/home/tristan/.config/buildstream.conf'
def load(self, config=None):
profile_start(Topics.LOAD_CONTEXT, 'load')
# If a specific config file is not specified, default to trying
# a $XDG_CONFIG_HOME/buildstream.conf file
#
if not config:
default_config = os.path.join(os.environ['XDG_CONFIG_HOME'],
'buildstream.conf')
if os.path.exists(default_config):
config = default_config
# Load default config
#
defaults = _yaml.load(_site.default_user_config)
if config:
self.config_origin = os.path.abspath(config)
user_config = _yaml.load(config)
_yaml.composite(defaults, user_config)
# Give obsoletion warnings
if defaults.get('builddir'):
raise LoadError(LoadErrorReason.INVALID_DATA,
> "builddir is obsolete, use cachedir")
E buildstream._exceptions.LoadError: builddir is obsolete, use cachedir
buildstream/_context.py:202: LoadError
The problem is simply that we are not overriding the XDG_
family of environment variables for tests, so the tests can be affected by the host environment.