From 7546fe2cb5203594066231b87ba86894f9507b38 Mon Sep 17 00:00:00 2001 From: Ar-Vi Date: Wed, 13 Jul 2022 20:08:41 -0400 Subject: [PATCH 1/4] Fix Flaky Test --- test/test_prase_it.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_prase_it.py b/test/test_prase_it.py index 521b8af..97164b1 100644 --- a/test/test_prase_it.py +++ b/test/test_prase_it.py @@ -1319,6 +1319,7 @@ def test_parser_read_all_configuration_variables_type_estimate_false(self): self.assertEqual(reply["test_env_type_estimate"], "123") def test_parser_read_all_configuration_variables_raise_allowed_types_error(self): + os.environ['FILE_TYPE'] = 'envvar' parser = ParseIt(config_location=test_files_location) with self.assertRaises(TypeError): parser.read_all_configuration_variables(allowed_types={"file_type": [bool, dict]}) From f9f188e9a2fa3873bc9ea41ef5176c509f88fecf Mon Sep 17 00:00:00 2001 From: Ar-Vi Date: Fri, 5 Aug 2022 00:04:07 +0530 Subject: [PATCH 2/4] Fix Flaky Test --- test/test_prase_it.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_prase_it.py b/test/test_prase_it.py index 97164b1..253695f 100644 --- a/test/test_prase_it.py +++ b/test/test_prase_it.py @@ -1323,6 +1323,7 @@ def test_parser_read_all_configuration_variables_raise_allowed_types_error(self) parser = ParseIt(config_location=test_files_location) with self.assertRaises(TypeError): parser.read_all_configuration_variables(allowed_types={"file_type": [bool, dict]}) + os.environ['FILE_TYPE'] = 'env' def test_parser_read_all_configuration_variables_raise_required_error(self): parser = ParseIt(config_location=test_files_location) From 8d2f0dee2b82fe2193b5c770d4f881a2fa5ceadf Mon Sep 17 00:00:00 2001 From: Ar-Vi Date: Sat, 6 Aug 2022 18:15:11 +0530 Subject: [PATCH 3/4] Updated changes to adress dev feedback --- test/test_prase_it.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test_prase_it.py b/test/test_prase_it.py index 253695f..1036119 100644 --- a/test/test_prase_it.py +++ b/test/test_prase_it.py @@ -26,7 +26,7 @@ "xml" ] -test_files_location = os.getenv("TEST_FILES_LOCATION", "test_files") +test_files_location = os.getenv("TEST_FILES_LOCATION", "test/test_files") class BaseTests(TestCase): @@ -120,6 +120,7 @@ def test_read_envvar_single_file_config(self): parser = ParseIt(config_location=test_files_location + "/test.hcl") reply = parser.read_configuration_variable("file_type") self.assertEqual(reply, "envvar") + del os.environ["FILE_TYPE"] def test_read_cli_args_folder_does_not_exist_raise_warn(self): with self.assertWarns(Warning): @@ -781,6 +782,7 @@ def test_envvar_defined_true(self): os.environ["TEST_ENV"] = "123" reply = envvar_defined("TEST_ENV") self.assertTrue(reply) + del os.environ["TEST_ENV"] def test_envvar_defined_false(self): reply = envvar_defined("TEST_ENV") @@ -790,11 +792,13 @@ def test_envvar_defined_true_upper_case(self): os.environ["TEST_ENV"] = "123" reply = envvar_defined("test_env", force_uppercase=True) self.assertTrue(reply) + del os.environ["TEST_ENV"] def test_envvar_defined_false_upper_case(self): os.environ["TEST_ENV"] = "123" reply = envvar_defined("test_env", force_uppercase=False) self.assertFalse(reply) + del os.environ["TEST_ENV"] def test_read_all_envvars_to_dict_force_uppercase_true(self): test_envvars = {"TEST_ENV": "123", "test_env_lowercase": "456"} @@ -1319,11 +1323,9 @@ def test_parser_read_all_configuration_variables_type_estimate_false(self): self.assertEqual(reply["test_env_type_estimate"], "123") def test_parser_read_all_configuration_variables_raise_allowed_types_error(self): - os.environ['FILE_TYPE'] = 'envvar' parser = ParseIt(config_location=test_files_location) with self.assertRaises(TypeError): parser.read_all_configuration_variables(allowed_types={"file_type": [bool, dict]}) - os.environ['FILE_TYPE'] = 'env' def test_parser_read_all_configuration_variables_raise_required_error(self): parser = ParseIt(config_location=test_files_location) From cb2ca7c10975b7a7e9f500b506bb5b15a63f8352 Mon Sep 17 00:00:00 2001 From: Ar-Vi Date: Sat, 6 Aug 2022 18:15:11 +0530 Subject: [PATCH 4/4] Updated changes to address dev feedback --- test/test_prase_it.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test_prase_it.py b/test/test_prase_it.py index 253695f..1036119 100644 --- a/test/test_prase_it.py +++ b/test/test_prase_it.py @@ -26,7 +26,7 @@ "xml" ] -test_files_location = os.getenv("TEST_FILES_LOCATION", "test_files") +test_files_location = os.getenv("TEST_FILES_LOCATION", "test/test_files") class BaseTests(TestCase): @@ -120,6 +120,7 @@ def test_read_envvar_single_file_config(self): parser = ParseIt(config_location=test_files_location + "/test.hcl") reply = parser.read_configuration_variable("file_type") self.assertEqual(reply, "envvar") + del os.environ["FILE_TYPE"] def test_read_cli_args_folder_does_not_exist_raise_warn(self): with self.assertWarns(Warning): @@ -781,6 +782,7 @@ def test_envvar_defined_true(self): os.environ["TEST_ENV"] = "123" reply = envvar_defined("TEST_ENV") self.assertTrue(reply) + del os.environ["TEST_ENV"] def test_envvar_defined_false(self): reply = envvar_defined("TEST_ENV") @@ -790,11 +792,13 @@ def test_envvar_defined_true_upper_case(self): os.environ["TEST_ENV"] = "123" reply = envvar_defined("test_env", force_uppercase=True) self.assertTrue(reply) + del os.environ["TEST_ENV"] def test_envvar_defined_false_upper_case(self): os.environ["TEST_ENV"] = "123" reply = envvar_defined("test_env", force_uppercase=False) self.assertFalse(reply) + del os.environ["TEST_ENV"] def test_read_all_envvars_to_dict_force_uppercase_true(self): test_envvars = {"TEST_ENV": "123", "test_env_lowercase": "456"} @@ -1319,11 +1323,9 @@ def test_parser_read_all_configuration_variables_type_estimate_false(self): self.assertEqual(reply["test_env_type_estimate"], "123") def test_parser_read_all_configuration_variables_raise_allowed_types_error(self): - os.environ['FILE_TYPE'] = 'envvar' parser = ParseIt(config_location=test_files_location) with self.assertRaises(TypeError): parser.read_all_configuration_variables(allowed_types={"file_type": [bool, dict]}) - os.environ['FILE_TYPE'] = 'env' def test_parser_read_all_configuration_variables_raise_required_error(self): parser = ParseIt(config_location=test_files_location)