From 6173e1b7b6addc22ab84b501241346f414058c61 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Mon, 21 Jun 2021 09:26:37 -0400 Subject: [PATCH] Add test for option.from_ini() missing envs not required --- .../providers/test_configuration_py2_py3.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/unit/providers/test_configuration_py2_py3.py b/tests/unit/providers/test_configuration_py2_py3.py index 70d2a6fb..978a686e 100644 --- a/tests/unit/providers/test_configuration_py2_py3.py +++ b/tests/unit/providers/test_configuration_py2_py3.py @@ -654,6 +654,31 @@ class ConfigFromIniWithEnvInterpolationTests(unittest.TestCase): self.assertEqual(self.config.section1.value1(), '') self.assertEqual(self.config.section1.value2(), '/path') + def test_option_missing_envs(self): + del os.environ['CONFIG_TEST_ENV'] + del os.environ['CONFIG_TEST_PATH'] + + self.config.option.from_ini(self.config_file) + + self.assertEqual( + self.config.option(), + { + 'section1': { + 'value1': '', + 'value2': '/path', + }, + }, + ) + self.assertEqual( + self.config.option.section1(), + { + 'value1': '', + 'value2': '/path', + }, + ) + self.assertEqual(self.config.option.section1.value1(), '') + self.assertEqual(self.config.option.section1.value2(), '/path') + def test_default_values(self): os.environ['DEFINED'] = 'defined' self.addCleanup(os.environ.pop, 'DEFINED')