diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-07-06 09:58:06 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-01-14 13:48:20 +0200 |
commit | 8b41fbc353a8eb25450baede0905fb8c43e5396c (patch) | |
tree | 33a96ab1b2a470552a282aea28cb6c4ded984eb9 /tests | |
parent | d1230a20b6e504bf026647205611bac33807b111 (diff) | |
download | git-buildpackage-8b41fbc353a8eb25450baede0905fb8c43e5396c.tar.gz git-buildpackage-8b41fbc353a8eb25450baede0905fb8c43e5396c.tar.bz2 git-buildpackage-8b41fbc353a8eb25450baede0905fb8c43e5396c.zip |
config: read the right config if run from subdir
A step towards being able to run GBP tools from subdirectories.
Now expands '%(top_dir)s' and '%(git_dir)s' in config file path to root
of the working directory and git metadata directory, respectively.
Also, adds a new method _read_config_file() in preparation for
supporting per-tree config files.
Fixes tests.test_Config: currently the only correct way to define the
config file(s) to be parsed is by using the GBP_CONF_FILES environment
variable.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_Config.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_Config.py b/tests/test_Config.py index 9a68f8cc..c4666f4d 100644 --- a/tests/test_Config.py +++ b/tests/test_Config.py @@ -67,14 +67,14 @@ def test_parser_fallback(): >>> import os >>> from gbp.config import GbpOptionParser - >>> parser = GbpOptionParser('foo') >>> tmpdir = str(context.new_tmpdir('foo')) >>> confname = os.path.join(tmpdir, 'gbp.conf') - >>> parser.config_files = [confname] >>> f = open(confname, 'w') >>> f.write('[foo]\\nthere = is\\n[git-foo]\\nno = truth\\n') >>> f.close() - >>> parser._parse_config_files() + >>> os.environ['GBP_CONF_FILES'] = confname + >>> parser = GbpOptionParser('foo') + >>> del os.environ['GBP_CONF_FILES'] >>> parser.config['there'] 'is' >>> parser.config['no'] @@ -86,21 +86,21 @@ def test_filter(): The filter option should always parse as a list >>> import os >>> from gbp.config import GbpOptionParser - >>> parser = GbpOptionParser('bar') >>> tmpdir = str(context.new_tmpdir('bar')) >>> confname = os.path.join(tmpdir, 'gbp.conf') - >>> parser.config_files = [confname] >>> f = open(confname, 'w') >>> f.write('[bar]\\nfilter = asdf\\n') >>> f.close() - >>> parser._parse_config_files() + >>> os.environ['GBP_CONF_FILES'] = confname + >>> parser = GbpOptionParser('bar') >>> parser.config['filter'] ['asdf'] >>> f = open(confname, 'w') >>> f.write("[bar]\\nfilter = ['this', 'is', 'a', 'list']\\n") >>> f.close() - >>> parser._parse_config_files() + >>> parser = GbpOptionParser('bar') >>> parser.config['filter'] ['this', 'is', 'a', 'list'] + >>> del os.environ['GBP_CONF_FILES'] """ |