aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2015-05-04 18:54:33 +0200
committerGuido Günther <agx@sigxcpu.org>2015-05-05 08:51:45 +0200
commitf22785b525077d8f4cbac1d674b6cb8af6fb28b1 (patch)
treea46004afedf8430c57f88286f01490648b5f2ae1
parent5280d82e2bfaa8723246df0178d67615400a4d78 (diff)
Allow to disable config section deprecations
Config section deprecations can be disabled by setting GBP_DISABLE_SECTION_DEPRECTATION=true in the environment.
-rw-r--r--gbp/config.py7
-rw-r--r--tests/18_test_Config.py11
2 files changed, 15 insertions, 3 deletions
diff --git a/gbp/config.py b/gbp/config.py
index 8cfac0d0..dbe56907 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -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):
"""
diff --git a/tests/18_test_Config.py b/tests/18_test_Config.py
index 33373607..306999f3 100644
--- a/tests/18_test_Config.py
+++ b/tests/18_test_Config.py
@@ -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):
"""