confini

Parse and merge multiple ini files in python3
git clone git://git.defalsify.org/python-confini.git
Log | Files | Refs | README | LICENSE

commit 346f6c8f15645ed89efc5deca61b138ebca8862d
parent 0d49e7d6e0c3c27e33137d8fdaf690df24d89649
Author: nolash <dev@holbrook.no>
Date:   Tue,  2 Nov 2021 09:40:41 +0100

Remove persistent parser object in config

Diffstat:
Mconfini/config.py | 2+-
Mtests/test_basic.py | 11++---------
2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/confini/config.py b/confini/config.py @@ -25,10 +25,10 @@ def set_current(conf, description=''): class Config: - parser = configparser.ConfigParser(strict=True) default_censor_string = '***' def __init__(self, default_dir, env_prefix=None, override_dirs=[]): + self.parser = configparser.ConfigParser(strict=True) self.__target_tmpdir = None if default_dir == None: default_dir = override_dirs diff --git a/tests/test_basic.py b/tests/test_basic.py @@ -13,14 +13,6 @@ class TestBasic(unittest.TestCase): wd = os.path.dirname(__file__) - def setUp(self): - pass - - - def tearDown(self): - pass - - def test_parse_default(self): inidir = os.path.join(self.wd, 'files/default') c = Config(inidir) @@ -74,9 +66,10 @@ class TestBasic(unittest.TestCase): self.assertDictEqual(expect, c.store) - def test_require(self): + def test_remove_require(self): inidir = os.path.join(self.wd, 'files') c = Config(inidir) + c.process() c.require('BERT', 'XYZZY') self.assertTrue(c.validate()) c.require('ERNIE', 'XYZZY')