Mercurial > hgrepos > Python > libs > ConfigMix
diff tests/test.py @ 112:c50ad93eb5dc
Implemented a "safe_load()" to load with safe merging
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Sat, 24 Mar 2018 20:57:42 +0100 |
| parents | 057d87d030f1 |
| children | 5b667c252f8c |
line wrap: on
line diff
--- a/tests/test.py Sat Mar 24 18:47:54 2018 +0100 +++ b/tests/test.py Sat Mar 24 20:57:42 2018 +0100 @@ -90,10 +90,10 @@ self.__check_tree(cfg) -class T02LoadAndMerge(unittest.TestCase): +class _T02MixinLoadAndMerge: def test01_load(self): - cfg = configmix.load( + cfg = self._load( os.path.join(TESTDATADIR, "conf20.yml"), os.path.join(TESTDATADIR, "conf21.yml")) @@ -128,7 +128,7 @@ cfg.getvar_s("test.Str")) def test02_load_with_ini(self): - cfg = configmix.load( + cfg = self._load( os.path.join(TESTDATADIR, "conf20.yml"), os.path.join(TESTDATADIR, "conf21.yml"), os.path.join(TESTDATADIR, "conf22.ini")) @@ -154,5 +154,17 @@ url) +class T02LoadAndMerge(_T02MixinLoadAndMerge, unittest.TestCase): + + def setUp(self): + self._load = configmix.load + + +class T03SafeLoadAndMerge(_T02MixinLoadAndMerge, unittest.TestCase): + + def setUp(self): + self._load = configmix.safe_load + + if __name__ == "__main__": unittest.main()
