config: restore mangled env in doctests
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Thu, 29 Aug 2013 12:50:15 +0000 (15:50 +0300)
committerGuido Günther <agx@sigxcpu.org>
Wed, 4 Sep 2013 20:02:39 +0000 (22:02 +0200)
Otherwise the mangled GBP_CONF_FILES affects also other doctests when
run with python-nose.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/config.py

index 84441b86d2c9b41a14ce230d1e1ee4f7f34237f2..4952de4a6c15ac06b3bf82f425f849f1aee259ae 100644 (file)
@@ -286,7 +286,8 @@ class GbpOptionParser(OptionParser):
         @return: list of config files we need to parse
         @rtype: C{list}
 
-        >>> if os.environ.has_key('GBP_CONF_FILES'): del os.environ['GBP_CONF_FILES']
+        >>> conf_backup = os.getenv('GBP_CONF_FILES')
+        >>> if conf_backup is not None: del os.environ['GBP_CONF_FILES']
         >>> files = GbpOptionParser.get_config_files()
 
         # Remove the ~-expanded one
@@ -297,6 +298,8 @@ class GbpOptionParser(OptionParser):
         >>> os.environ['GBP_CONF_FILES'] = 'test1:test2'
         >>> GbpOptionParser.get_config_files()
         ['test1', 'test2']
+        >>> del os.environ['GBP_CONF_FILES']
+        >>> if conf_backup is not None: os.environ['GBP_CONF_FILES'] = conf_backup
         """
         envvar = os.environ.get('GBP_CONF_FILES')
         files = envvar.split(':') if envvar else klass.def_config_files