This is an automated email from the ASF dual-hosted git repository.
shahar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 93f93035b5e Enable PT006 rule to airflow-core tests (core,
dag_processing) (#57948)
93f93035b5e is described below
commit 93f93035b5e9b616575d082f4c74b61886897e5f
Author: Chao-Hung Wan <[email protected]>
AuthorDate: Sat Nov 8 02:43:23 2025 +0800
Enable PT006 rule to airflow-core tests (core, dag_processing) (#57948)
Signed-off-by: Xch1 <[email protected]>
Co-authored-by: Kalyan R <[email protected]>
---
airflow-core/tests/unit/core/test_configuration.py | 8 ++++----
airflow-core/tests/unit/core/test_example_dags_system.py | 2 +-
airflow-core/tests/unit/core/test_settings.py | 2 +-
airflow-core/tests/unit/core/test_stats.py | 6 +++---
airflow-core/tests/unit/dag_processing/bundles/test_base.py | 4 ++--
.../tests/unit/dag_processing/bundles/test_dag_bundle_manager.py | 2 +-
airflow-core/tests/unit/dag_processing/test_collection.py | 6 +++---
airflow-core/tests/unit/dag_processing/test_dagbag.py | 4 ++--
airflow-core/tests/unit/dag_processing/test_manager.py | 8 ++++----
airflow-core/tests/unit/dag_processing/test_processor.py | 8 ++++----
10 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/airflow-core/tests/unit/core/test_configuration.py
b/airflow-core/tests/unit/core/test_configuration.py
index 493b8800bae..77cd63a35be 100644
--- a/airflow-core/tests/unit/core/test_configuration.py
+++ b/airflow-core/tests/unit/core/test_configuration.py
@@ -685,7 +685,7 @@ key3 = value3
assert content["secret_key"] == "difficult_unpredictable_cat_password"
@pytest.mark.parametrize(
- "key, type",
+ ("key", "type"),
[
("string_value", int), # Coercion happens here
("only_bool_value", bool),
@@ -719,7 +719,7 @@ key3 = value3
# the environment variable's echo command
assert test_cmdenv_conf.get("testcmdenv", "notacommand") == "OK"
- @pytest.mark.parametrize("display_sensitive, result", [(True, "OK"),
(False, "< hidden >")])
+ @pytest.mark.parametrize(("display_sensitive", "result"), [(True, "OK"),
(False, "< hidden >")])
def test_as_dict_display_sensitivewith_command_from_env(self,
display_sensitive, result):
test_cmdenv_conf = AirflowConfigParser()
test_cmdenv_conf.sensitive_config_values.add(("testcmdenv",
"itsacommand"))
@@ -1124,7 +1124,7 @@ class TestDeprecatedConf:
assert conf.getint("celery", "worker_concurrency") == 99
@pytest.mark.parametrize(
- "deprecated_options_dict, kwargs, new_section_expected_value,
old_section_expected_value",
+ ("deprecated_options_dict", "kwargs", "new_section_expected_value",
"old_section_expected_value"),
[
pytest.param(
{("old_section", "old_key"): ("new_section", "new_key",
"2.0.0")},
@@ -1214,7 +1214,7 @@ sql_alchemy_conn=sqlite://test
assert test_conf.get("core", "hostname_callable") ==
"airflow.utils.net.getfqdn"
@pytest.mark.parametrize(
- "old, new",
+ ("old", "new"),
[
(
("core", "sql_alchemy_conn",
"postgres+psycopg2://localhost/postgres"),
diff --git a/airflow-core/tests/unit/core/test_example_dags_system.py
b/airflow-core/tests/unit/core/test_example_dags_system.py
index 2ecad589aba..9794307b454 100644
--- a/airflow-core/tests/unit/core/test_example_dags_system.py
+++ b/airflow-core/tests/unit/core/test_example_dags_system.py
@@ -88,7 +88,7 @@ class TestExampleDagsSystem(SystemTest):
test_run()
@pytest.mark.parametrize(
- "factory, expected",
+ ("factory", "expected"),
[
(get_dag_fail, "failed"),
(get_dag_fail_root, "failed"),
diff --git a/airflow-core/tests/unit/core/test_settings.py
b/airflow-core/tests/unit/core/test_settings.py
index c701588268f..44f119678d8 100644
--- a/airflow-core/tests/unit/core/test_settings.py
+++ b/airflow-core/tests/unit/core/test_settings.py
@@ -200,7 +200,7 @@ _local_db_path_error =
pytest.raises(AirflowConfigException, match=r"Cannot use
@pytest.mark.parametrize(
- ["value", "expectation"],
+ ("value", "expectation"),
[
("sqlite:///./relative_path.db", _local_db_path_error),
("sqlite:///relative/path.db", _local_db_path_error),
diff --git a/airflow-core/tests/unit/core/test_stats.py
b/airflow-core/tests/unit/core/test_stats.py
index 12ed4207d42..7fe0a469188 100644
--- a/airflow-core/tests/unit/core/test_stats.py
+++ b/airflow-core/tests/unit/core/test_stats.py
@@ -282,7 +282,7 @@ class TestDogStats:
class TestStatsAllowAndBlockLists:
@pytest.mark.parametrize(
- "validator, stat_name, expect_incr",
+ ("validator", "stat_name", "expect_incr"),
[
(PatternAllowListValidator, "stats_one", True),
(PatternAllowListValidator, "stats_two.bla", True),
@@ -309,7 +309,7 @@ class TestStatsAllowAndBlockLists:
statsd_client.assert_not_called()
@pytest.mark.parametrize(
- "match_pattern, expect_incr",
+ ("match_pattern", "expect_incr"),
[
("^stat", True), # Match: Regex Startswith
("a.{4}o", True), # Match: RegEx Pattern
@@ -343,7 +343,7 @@ class TestPatternValidatorConfigOption:
block_list = {("metrics", "metrics_block_list"): "foo,bar"}
@pytest.mark.parametrize(
- "config, expected",
+ ("config", "expected"),
[
pytest.param(
{**stats_on},
diff --git a/airflow-core/tests/unit/dag_processing/bundles/test_base.py
b/airflow-core/tests/unit/dag_processing/bundles/test_base.py
index 7da3baa3b9f..58f7c233337 100644
--- a/airflow-core/tests/unit/dag_processing/bundles/test_base.py
+++ b/airflow-core/tests/unit/dag_processing/bundles/test_base.py
@@ -51,7 +51,7 @@ def bundle_temp_dir(tmp_path):
@pytest.mark.parametrize(
- "val, expected",
+ ("val", "expected"),
[
("/blah", Path("/blah")),
("", Path(tempfile.gettempdir(), "airflow", "dag_bundles")),
@@ -215,7 +215,7 @@ class FakeBundle(BaseDagBundle):
class TestBundleUsageTrackingManager:
@pytest.mark.parametrize(
- "threshold_hours, min_versions, when_hours, expected_remaining",
+ ("threshold_hours", "min_versions", "when_hours",
"expected_remaining"),
[
(3, 0, 3, 5),
(3, 0, 6, 2),
diff --git
a/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
b/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
index f911027ef7a..888b85cd30c 100644
--- a/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
+++ b/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
@@ -35,7 +35,7 @@ from tests_common.test_utils.db import clear_db_dag_bundles
@pytest.mark.parametrize(
- "value, expected",
+ ("value", "expected"),
[
pytest.param(None, {"dags-folder"}, id="default"),
pytest.param("{}", set(), id="empty dict"),
diff --git a/airflow-core/tests/unit/dag_processing/test_collection.py
b/airflow-core/tests/unit/dag_processing/test_collection.py
index 92c03e97c52..64e15ede317 100644
--- a/airflow-core/tests/unit/dag_processing/test_collection.py
+++ b/airflow-core/tests/unit/dag_processing/test_collection.py
@@ -128,7 +128,7 @@ class TestAssetModelOperation:
self.clean_db()
@pytest.mark.parametrize(
- "is_active, is_paused, expected_num_triggers",
+ ("is_active", "is_paused", "expected_num_triggers"),
[
(True, True, 0),
(True, False, 1),
@@ -170,7 +170,7 @@ class TestAssetModelOperation:
assert len(asset_model.triggers) == expected_num_triggers
@pytest.mark.parametrize(
- "schedule, model, columns, expected",
+ ("schedule", "model", "columns", "expected"),
[
pytest.param(
Asset.ref(name="name1"),
@@ -954,7 +954,7 @@ class TestUpdateDagTags:
session.commit()
@pytest.mark.parametrize(
- ["initial_tags", "new_tags", "expected_tags"],
+ ("initial_tags", "new_tags", "expected_tags"),
[
(["dangerous"], {"DANGEROUS"}, {"DANGEROUS"}),
(["existing"], {"existing", "new"}, {"existing", "new"}),
diff --git a/airflow-core/tests/unit/dag_processing/test_dagbag.py
b/airflow-core/tests/unit/dag_processing/test_dagbag.py
index 0b25346814b..7e95d12bb55 100644
--- a/airflow-core/tests/unit/dag_processing/test_dagbag.py
+++ b/airflow-core/tests/unit/dag_processing/test_dagbag.py
@@ -837,7 +837,7 @@ with airflow.DAG(
+ "NameError: name 'airflow_DAG' is not defined\n"
)
- @pytest.mark.parametrize(("depth",), ((None,), (1,)))
+ @pytest.mark.parametrize("depth", (None, 1))
def test_import_error_tracebacks(self, tmp_path, depth):
unparseable_filename = tmp_path.joinpath("dag.py").as_posix()
with open(unparseable_filename, "w") as unparseable_file:
@@ -852,7 +852,7 @@ with airflow.DAG(
assert unparseable_filename in import_errors
assert import_errors[unparseable_filename] ==
self._make_test_traceback(unparseable_filename, depth)
- @pytest.mark.parametrize(("depth",), ((None,), (1,)))
+ @pytest.mark.parametrize("depth", (None, 1))
def test_import_error_tracebacks_zip(self, tmp_path, depth):
invalid_zip_filename = (tmp_path / "test_zip_invalid.zip").as_posix()
invalid_dag_filename = os.path.join(invalid_zip_filename, "dag.py")
diff --git a/airflow-core/tests/unit/dag_processing/test_manager.py
b/airflow-core/tests/unit/dag_processing/test_manager.py
index d5d7135ea4e..6bb1aea8d8f 100644
--- a/airflow-core/tests/unit/dag_processing/test_manager.py
+++ b/airflow-core/tests/unit/dag_processing/test_manager.py
@@ -553,7 +553,7 @@ class TestDagFileProcessorManager:
@pytest.mark.usefixtures("testing_dag_bundle")
@pytest.mark.parametrize(
- ["callbacks", "path", "expected_body"],
+ ("callbacks", "path", "expected_body"),
[
pytest.param(
[],
@@ -748,7 +748,7 @@ class TestDagFileProcessorManager:
assert session.get(DagModel, "test_dag2").is_stale is True
@pytest.mark.parametrize(
- "rel_filelocs, expected_return, expected_dag1_stale,
expected_dag2_stale",
+ ("rel_filelocs", "expected_return", "expected_dag1_stale",
"expected_dag2_stale"),
[
pytest.param(
["test_dag1.py"], # Only dag1 present, dag2 deleted
@@ -787,7 +787,7 @@ class TestDagFileProcessorManager:
assert session.get(DagModel, "test_dag2").is_stale is
expected_dag2_stale
@pytest.mark.parametrize(
- "active_files, should_call_cleanup",
+ ("active_files", "should_call_cleanup"),
[
pytest.param(
[
@@ -1295,7 +1295,7 @@ class TestDagFileProcessorManager:
bundleone.get_current_version.assert_called_once()
@pytest.mark.parametrize(
- "bundle_names, expected",
+ ("bundle_names", "expected"),
[
(None, {"bundle1", "bundle2", "bundle3"}),
(["bundle1"], {"bundle1"}),
diff --git a/airflow-core/tests/unit/dag_processing/test_processor.py
b/airflow-core/tests/unit/dag_processing/test_processor.py
index 35c6babe3a8..e386ba85ec4 100644
--- a/airflow-core/tests/unit/dag_processing/test_processor.py
+++ b/airflow-core/tests/unit/dag_processing/test_processor.py
@@ -941,7 +941,7 @@ class TestExecuteDagCallbacks:
_execute_dag_callbacks(dagbag, request, log)
@pytest.mark.parametrize(
- "xcom_operation,expected_message_type,expected_message,mock_response",
+ ("xcom_operation", "expected_message_type", "expected_message",
"mock_response"),
[
(
lambda ti, task_ids: ti.xcom_pull(key="report_df",
task_ids=task_ids),
@@ -1062,7 +1062,7 @@ class TestExecuteDagCallbacks:
mock_supervisor_comms.send.assert_called_once_with(msg=expected_message)
@pytest.mark.parametrize(
- "request_operation,operation_type,mock_response,operation_response",
+ ("request_operation", "operation_type", "mock_response",
"operation_response"),
[
(
lambda context:
context["task_instance"].get_ti_count(dag_id="test_dag"),
@@ -1409,7 +1409,7 @@ class TestExecuteTaskCallbacks:
assert call_count == 2
@pytest.mark.parametrize(
- "dag_exists,task_exists,expected_error",
+ ("dag_exists", "task_exists", "expected_error"),
[
(False, False, "DAG 'missing_dag' not found in DagBag"),
(True, False, "Task 'missing_task' not found in DAG 'test_dag'"),
@@ -1701,7 +1701,7 @@ class TestExecuteEmailCallbacks:
assert "Email not sent - task configured with email_on_" in info_call
@pytest.mark.parametrize(
- "dag_exists,task_exists,expected_error",
+ ("dag_exists", "task_exists", "expected_error"),
[
(False, False, "DAG 'missing_dag' not found in DagBag"),
(True, False, "Task 'missing_task' not found in DAG 'test_dag'"),