uranusjr commented on code in PR #32117:
URL: https://github.com/apache/airflow/pull/32117#discussion_r1338336823


##########
airflow/configuration.py:
##########
@@ -1800,6 +1800,13 @@ def load_test_config(self):
         self.expand_all_configuration_values()
         log.info("Unit test configuration loaded from 'config_unit_tests.cfg'")
 
+        # Remove environment variables to ensure the unit test configs take 
effect.
+        airflow_cfg_keys = {k for k in os.environ if 
re2.match(r"^AIRFLOW__[^_]+__[^_].+$", k.upper())}
+        for k in airflow_cfg_keys:
+            del os.environ[k]

Review Comment:
   ```suggestion
           os.environ = {
               k: v
               for k, v in os.environ.items()
               if re2.match(r"^AIRFLOW__[^_]+__[^_].+$", k.upper()) is None
           }
   ```
   
   I think this works



##########
airflow/configuration.py:
##########
@@ -1800,6 +1800,13 @@ def load_test_config(self):
         self.expand_all_configuration_values()
         log.info("Unit test configuration loaded from 'config_unit_tests.cfg'")
 
+        # Remove environment variables to ensure the unit test configs take 
effect.
+        airflow_cfg_keys = {k for k in os.environ if 
re2.match(r"^AIRFLOW__[^_]+__[^_].+$", k.upper())}
+        for k in airflow_cfg_keys:
+            del os.environ[k]

Review Comment:
   ```suggestion
           os.environ = {
               k: v
               for k, v in os.environ.items()
               if re2.match(r"^AIRFLOW__[^_]+__[^_].+$", k.upper()) is None
           }
   ```
   
   I think this works



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to