Prefix replacement in warning

This commit is contained in:
Stefano Rivera 2010-12-22 00:14:28 +02:00
parent b46114c20f
commit 0184a10c21
2 changed files with 6 additions and 2 deletions

View File

@ -98,9 +98,12 @@ class UDTConfig(object):
else:
continue
if k in compat_keys:
r_prefix = self.prefix
if key in self.defaults:
r_prefix = 'UBUNTUTOOLS'
print >> stderr, (
'W: Deprecated configuration variable: %s. '
'Replaced by %s.') % (k, key)
'Replaced by %s_%s.') % (k, r_prefix, key)
return value
return default

View File

@ -128,7 +128,8 @@ REPEAT=yes
errs = ubuntutools.config.stderr.getvalue().strip()
ubuntutools.config.stderr = StringIO()
self.assertEqual(len(errs.splitlines()), 1)
self.assertRegexpMatches(errs, r'Deprecated.*\bCOMPATFOOBAR\b.*\bQUX\b')
self.assertRegexpMatches(errs,
r'Deprecated.*\bCOMPATFOOBAR\b.*\bTEST_QUX\b')
def test_boolean(self):
config_files['user'] = "TEST_BOOLEAN=yes"