mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-14 00:21:08 +00:00
Script-specific variables win over package variables no matter which store they come from
This commit is contained in:
parent
4336f7442a
commit
4f7a5232a2
@ -70,8 +70,8 @@ class UDTConfig(object):
|
||||
keys are prefixed with the script name, falling back to UBUNTUTOOLS for
|
||||
package-wide keys.
|
||||
|
||||
Store Priority: Environment variables, user conf, system conf
|
||||
Variable Priority: PREFIX_KEY, UBUNTUTOOLS_KEY, compat_keys
|
||||
Store Priority: Environment variables, user conf, system conf
|
||||
|
||||
Historical variable names can be supplied via compat_keys, no prefix is
|
||||
applied to them.
|
||||
@ -84,8 +84,8 @@ class UDTConfig(object):
|
||||
keys.append('UBUNTUTOOLS_' + key)
|
||||
keys += compat_keys
|
||||
|
||||
for store in (os.environ, self.config):
|
||||
for k in keys:
|
||||
for k in keys:
|
||||
for store in (os.environ, self.config):
|
||||
if k in store:
|
||||
value = store[k]
|
||||
if value in ('yes', 'no'):
|
||||
|
@ -108,16 +108,15 @@ REPEAT=yes
|
||||
os.environ['UBUNTUTOOLS_BUILDER'] = 'baz'
|
||||
self.assertEqual(self.get_value('BUILDER'), 'baz')
|
||||
|
||||
def test_any_environment_precedence(self):
|
||||
def test_general_environment_specific_config_precedence(self):
|
||||
config_files['user'] = "TEST_BUILDER=bar"
|
||||
os.environ['UBUNTUTOOLS_BUILDER'] = 'foo'
|
||||
self.assertEqual(self.get_value('BUILDER'), 'foo')
|
||||
self.assertEqual(self.get_value('BUILDER'), 'bar')
|
||||
|
||||
def test_compat_environment_precedence(self):
|
||||
config_files['user'] = "TEST_BUILDER=bar"
|
||||
os.environ['BUILDER'] = 'baz'
|
||||
self.assertEqual(self.get_value('BUILDER', compat_keys=['BUILDER']),
|
||||
'baz')
|
||||
def test_compat_keys(self):
|
||||
config_files['user'] = 'COMPATFOOBAR=bar'
|
||||
self.assertEqual(self.get_value('QUX', compat_keys=['COMPATFOOBAR']),
|
||||
'bar')
|
||||
|
||||
def test_boolean(self):
|
||||
config_files['user'] = "TEST_BOOLEAN=yes"
|
||||
|
Loading…
x
Reference in New Issue
Block a user