@@ -2879,3 +2879,51 @@ def test_stores_evaluation_parameters_resolve_correctly(data_context_with_query_
28792879 )
28802880 checkpoint_result = checkpoint .run ()
28812881 assert checkpoint_result .get ("success" ) is True
2882+
2883+
2884+ def test_modifications_to_env_vars_is_recognized_within_same_program_execution (
2885+ empty_data_context : DataContext , monkeypatch
2886+ ) -> None :
2887+ """
2888+ What does this test do and why?
2889+
2890+ Great Expectations recognizes changes made to environment variables within a program execution
2891+ and ensures that these changes are recognized in subsequent calls within the same process.
2892+
2893+ This is particularly relevant when performing substitutions within a user's project config.
2894+ """
2895+ context : DataContext = empty_data_context
2896+ env_var_name : str = "MY_PLUGINS_DIRECTORY"
2897+ env_var_value : str = "my_patched_value"
2898+
2899+ context .config .plugins_directory = f"${ env_var_name } "
2900+ monkeypatch .setenv (env_var_name , env_var_value )
2901+
2902+ assert context .plugins_directory and context .plugins_directory .endswith (
2903+ env_var_value
2904+ )
2905+
2906+
2907+ def test_modifications_to_config_vars_is_recognized_within_same_program_execution (
2908+ empty_data_context : DataContext ,
2909+ ) -> None :
2910+ """
2911+ What does this test do and why?
2912+
2913+ Great Expectations recognizes changes made to config variables within a program execution
2914+ and ensures that these changes are recognized in subsequent calls within the same process.
2915+
2916+ This is particularly relevant when performing substitutions within a user's project config.
2917+ """
2918+ context : DataContext = empty_data_context
2919+ config_var_name : str = "my_plugins_dir"
2920+ config_var_value : str = "my_patched_value"
2921+
2922+ context .config .plugins_directory = f"${ config_var_name } "
2923+ context .save_config_variable (
2924+ config_variable_name = config_var_name , value = config_var_value
2925+ )
2926+
2927+ assert context .plugins_directory and context .plugins_directory .endswith (
2928+ config_var_value
2929+ )
0 commit comments