You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Lee-W (via GitHub)" <gi...@apache.org> on 2025/03/03 04:45:30 UTC
Re: [PR] Fix `lookup_from_deprecated_options` in AirflowConfigParser [airflow]
Lee-W commented on code in PR #47004:
URL: https://github.com/apache/airflow/pull/47004#discussion_r1976863984
##########
tests/core/test_configuration.py:
##########
@@ -938,6 +938,48 @@ def test_deprecated_options(self):
with pytest.warns(DeprecationWarning), conf_vars({("celery", "celeryd_concurrency"): "99"}):
assert conf.getint("celery", "worker_concurrency") == 99
+ @pytest.mark.parametrize(
+ "deprecated_options_dict, kargs, new_section_expected, old_section_expected",
+ [
+ pytest.param(
+ {("old_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None},
+ None,
+ "value",
+ id="deprecated_in_different_section_lookup_enabled",
+ ),
+ pytest.param(
+ {("old_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None, "lookup_from_deprecated": False},
+ None,
+ None,
+ id="deprecated_in_different_section_lookup_disabled",
+ ),
+ pytest.param(
+ {("new_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None},
+ "value",
+ None,
+ id="deprecated_in_same_section_lookup_enabled",
+ ),
+ pytest.param(
+ {("new_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None, "lookup_from_deprecated": False},
+ None,
+ None,
+ id="deprecated_in_same_section_lookup_disabled",
+ ),
+ ],
+ )
+ def test_deprecated_options_with_lookup_from_deprecated(
+ self, deprecated_options_dict, kargs, new_section_expected, old_section_expected
+ ):
+ with conf_vars({("new_section", "new_key"): "value"}):
+ with set_deprecated_options(deprecated_options=deprecated_options_dict):
+ assert conf.get("new_section", "old_key", **kargs) == new_section_expected
+
+ assert conf.get("old_section", "old_key", **kargs) == old_section_expected
Review Comment:
```suggestion
assert conf.get("old_section", "old_key", **kwargs) == old_section_expected
```
##########
tests/core/test_configuration.py:
##########
@@ -938,6 +938,48 @@ def test_deprecated_options(self):
with pytest.warns(DeprecationWarning), conf_vars({("celery", "celeryd_concurrency"): "99"}):
assert conf.getint("celery", "worker_concurrency") == 99
+ @pytest.mark.parametrize(
+ "deprecated_options_dict, kargs, new_section_expected, old_section_expected",
+ [
+ pytest.param(
+ {("old_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None},
+ None,
+ "value",
+ id="deprecated_in_different_section_lookup_enabled",
+ ),
+ pytest.param(
+ {("old_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None, "lookup_from_deprecated": False},
+ None,
+ None,
+ id="deprecated_in_different_section_lookup_disabled",
+ ),
+ pytest.param(
+ {("new_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None},
+ "value",
+ None,
+ id="deprecated_in_same_section_lookup_enabled",
+ ),
+ pytest.param(
+ {("new_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None, "lookup_from_deprecated": False},
+ None,
+ None,
+ id="deprecated_in_same_section_lookup_disabled",
+ ),
+ ],
+ )
+ def test_deprecated_options_with_lookup_from_deprecated(
+ self, deprecated_options_dict, kargs, new_section_expected, old_section_expected
+ ):
+ with conf_vars({("new_section", "new_key"): "value"}):
+ with set_deprecated_options(deprecated_options=deprecated_options_dict):
+ assert conf.get("new_section", "old_key", **kargs) == new_section_expected
Review Comment:
```suggestion
assert conf.get("new_section", "old_key", **kwargs) == new_section_expected
```
##########
tests/core/test_configuration.py:
##########
@@ -938,6 +938,48 @@ def test_deprecated_options(self):
with pytest.warns(DeprecationWarning), conf_vars({("celery", "celeryd_concurrency"): "99"}):
assert conf.getint("celery", "worker_concurrency") == 99
+ @pytest.mark.parametrize(
+ "deprecated_options_dict, kargs, new_section_expected, old_section_expected",
+ [
+ pytest.param(
+ {("old_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None},
+ None,
+ "value",
+ id="deprecated_in_different_section_lookup_enabled",
+ ),
+ pytest.param(
+ {("old_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None, "lookup_from_deprecated": False},
+ None,
+ None,
+ id="deprecated_in_different_section_lookup_disabled",
+ ),
+ pytest.param(
+ {("new_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None},
+ "value",
+ None,
+ id="deprecated_in_same_section_lookup_enabled",
+ ),
+ pytest.param(
+ {("new_section", "old_key"): ("new_section", "new_key", "2.0.0")},
+ {"fallback": None, "lookup_from_deprecated": False},
+ None,
+ None,
+ id="deprecated_in_same_section_lookup_disabled",
+ ),
+ ],
+ )
+ def test_deprecated_options_with_lookup_from_deprecated(
+ self, deprecated_options_dict, kargs, new_section_expected, old_section_expected
Review Comment:
```suggestion
self, deprecated_options_dict, kwargs, new_section_expected, old_section_expected
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org