@@ -1040,11 +1040,14 @@ def test_deprecated_options(self):
10401040 # Remove it so we are sure we use the right setting
10411041 conf .remove_option ("celery" , "worker_concurrency" )
10421042
1043- with pytest .warns (DeprecationWarning ):
1043+ with pytest .warns (DeprecationWarning , match = "celeryd_concurrency" ):
10441044 with mock .patch .dict ("os.environ" , AIRFLOW__CELERY__CELERYD_CONCURRENCY = "99" ):
10451045 assert conf .getint ("celery" , "worker_concurrency" ) == 99
10461046
1047- with pytest .warns (DeprecationWarning ), conf_vars ({("celery" , "celeryd_concurrency" ): "99" }):
1047+ with (
1048+ pytest .warns (DeprecationWarning , match = "celeryd_concurrency" ),
1049+ conf_vars ({("celery" , "celeryd_concurrency" ): "99" }),
1050+ ):
10481051 assert conf .getint ("celery" , "worker_concurrency" ) == 99
10491052
10501053 @pytest .mark .parametrize (
@@ -1109,13 +1112,13 @@ def test_deprecated_options_cmd(self):
11091112 ):
11101113 conf .remove_option ("celery" , "result_backend" )
11111114 with conf_vars ({("celery" , "celery_result_backend_cmd" ): "/bin/echo 99" }):
1112- with pytest . warns ( DeprecationWarning ):
1113- tmp = None
1114- if "AIRFLOW__CELERY__RESULT_BACKEND" in os .environ :
1115- tmp = os . environ . pop ( "AIRFLOW__CELERY__RESULT_BACKEND" )
1115+ tmp = None
1116+ if "AIRFLOW__CELERY__RESULT_BACKEND" in os . environ :
1117+ tmp = os .environ . pop ( "AIRFLOW__CELERY__RESULT_BACKEND" )
1118+ with pytest . warns ( DeprecationWarning , match = "result_backend" ):
11161119 assert conf .getint ("celery" , "result_backend" ) == 99
1117- if tmp :
1118- os .environ ["AIRFLOW__CELERY__RESULT_BACKEND" ] = tmp
1120+ if tmp :
1121+ os .environ ["AIRFLOW__CELERY__RESULT_BACKEND" ] = tmp
11191122
11201123 def test_deprecated_values_from_conf (self ):
11211124 test_conf = AirflowConfigParser (
@@ -1135,7 +1138,7 @@ def test_deprecated_values_from_conf(self):
11351138
11361139 with pytest .warns (FutureWarning ):
11371140 test_conf .validate ()
1138- assert test_conf .get ("core" , "hostname_callable" ) == "airflow.utils.net.getfqdn"
1141+ assert test_conf .get ("core" , "hostname_callable" ) == "airflow.utils.net.getfqdn"
11391142
11401143 @pytest .mark .parametrize (
11411144 "old, new" ,
@@ -1160,19 +1163,19 @@ def test_deprecated_env_vars_upgraded_and_removed(self, old, new):
11601163 old_env_var = test_conf ._env_var_name (old_section , old_key )
11611164 new_env_var = test_conf ._env_var_name (new_section , new_key )
11621165
1163- with pytest .warns (FutureWarning ):
1164- with mock .patch .dict ("os.environ" , ** {old_env_var : old_value }):
1165- # Can't start with the new env var existing...
1166- os .environ .pop (new_env_var , None )
1166+ with mock .patch .dict ("os.environ" , ** {old_env_var : old_value }):
1167+ # Can't start with the new env var existing...
1168+ os .environ .pop (new_env_var , None )
11671169
1170+ with pytest .warns (FutureWarning ):
11681171 test_conf .validate ()
1169- assert test_conf .get (new_section , new_key ) == new_value
1170- # We also need to make sure the deprecated env var is removed
1171- # so that any subprocesses don't use it in place of our updated
1172- # value.
1173- assert old_env_var not in os .environ
1174- # and make sure we track the old value as well, under the new section/key
1175- assert test_conf .upgraded_values [(new_section , new_key )] == old_value
1172+ assert test_conf .get (new_section , new_key ) == new_value
1173+ # We also need to make sure the deprecated env var is removed
1174+ # so that any subprocesses don't use it in place of our updated
1175+ # value.
1176+ assert old_env_var not in os .environ
1177+ # and make sure we track the old value as well, under the new section/key
1178+ assert test_conf .upgraded_values [(new_section , new_key )] == old_value
11761179
11771180 @pytest .mark .parametrize (
11781181 "conf_dict" ,
@@ -1200,10 +1203,10 @@ def make_config():
12001203 test_conf .validate ()
12011204 return test_conf
12021205
1203- with pytest . warns ( FutureWarning ):
1204- with mock . patch . dict ( "os.environ" , AIRFLOW__CORE__HOSTNAME_CALLABLE = "airflow.utils.net:getfqdn" ):
1206+ with mock . patch . dict ( "os.environ" , AIRFLOW__CORE__HOSTNAME_CALLABLE = "airflow.utils.net:getfqdn" ):
1207+ with pytest . warns ( FutureWarning ):
12051208 test_conf = make_config ()
1206- assert test_conf .get ("core" , "hostname_callable" ) == "airflow.utils.net.getfqdn"
1209+ assert test_conf .get ("core" , "hostname_callable" ) == "airflow.utils.net.getfqdn"
12071210
12081211 with reset_warning_registry ():
12091212 with warnings .catch_warnings (record = True ) as warning :
0 commit comments