Commit f22785b5 authored by Guido Günther's avatar Guido Günther

Allow to disable config section deprecations

Config section deprecations can be disabled by setting

    GBP_DISABLE_SECTION_DEPRECTATION=true

in the environment.
parent 5280d82e
......@@ -364,9 +364,10 @@ class GbpOptionParser(OptionParser):
return
parser.read(filename)
def _warn_old_config(self, oldcmd, cmd):
gbp.log.warn("Old style config section [%s] found "
"please rename to [%s]" % (oldcmd, cmd))
def _warn_old_config_section(self, oldcmd, cmd):
if not os.getenv("GBP_DISABLE_SECTION_DEPRECTATION"):
gbp.log.warn("Old style config section [%s] found "
"please rename to [%s]" % (oldcmd, cmd))
def parse_config_files(self):
"""
......
......@@ -62,6 +62,17 @@ class TestConfigParser(unittest.TestCase, GbpLogTester):
for line in range(0, 2):
self._check_log(line, ".*Old style config section \[gbp-cmd3\] found please rename to \[cmd3\]")
def test_single_git_override_disabled_deprecations(self):
"""
With disabled deprecations we shouldn't see a log line
"""
for prefix in ['', 'git-']:
os.environ['GBP_DISABLE_SECTION_DEPRECTATION'] = 'true'
parser = GbpOptionParser('%scmd2' % prefix)
self.assertEqual(parser.config['single_git_override_option1'], 'single_git_override_value1')
for line in range(0, 2):
self._check_log_empty()
os.environ.pop('GBP_DISABLE_SECTION_DEPRECTATION')
def test_new_overrides_git(self):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment