You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by sh...@apache.org on 2025/11/07 20:54:15 UTC
(airflow) branch main updated: Enable PT006 rule to airflow-core tests (route/public) (#58011)
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 fc05e4bbe57 Enable PT006 rule to airflow-core tests (route/public) (#58011)
fc05e4bbe57 is described below
commit fc05e4bbe578a682b2be8cb4345a4e1c47ec50b0
Author: Chao-Hung Wan <qc...@gmail.com>
AuthorDate: Sat Nov 8 04:54:07 2025 +0800
Enable PT006 rule to airflow-core tests (route/public) (#58011)
Signed-off-by: Xch1 <qc...@gmail.com>
Co-authored-by: Kalyan R <ka...@live.com>
---
.../core_api/routes/public/test_assets.py | 20 +++++-----
.../core_api/routes/public/test_auth.py | 2 +-
.../core_api/routes/public/test_backfills.py | 10 ++---
.../core_api/routes/public/test_config.py | 8 ++--
.../core_api/routes/public/test_connections.py | 16 ++++----
.../core_api/routes/public/test_dag_run.py | 40 +++++++++----------
.../core_api/routes/public/test_dag_stats.py | 2 +-
.../core_api/routes/public/test_dag_tags.py | 2 +-
.../core_api/routes/public/test_dag_versions.py | 10 ++---
.../core_api/routes/public/test_dag_warning.py | 2 +-
.../core_api/routes/public/test_dags.py | 45 ++++++++++++++++------
11 files changed, 90 insertions(+), 67 deletions(-)
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
index 90a4164449d..0f14d58e4dd 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
@@ -491,7 +491,7 @@ class TestGetAssets(TestAssets):
assert response.json()["detail"] == msg
@pytest.mark.parametrize(
- "params, expected_assets",
+ ("params", "expected_assets"),
[
({"name_pattern": "s3"}, {"s3://folder/key"}),
({"name_pattern": "bucket"}, {"gcp://bucket/key", "wasb://some_asset_bucket_/key"}),
@@ -527,7 +527,7 @@ class TestGetAssets(TestAssets):
assert expected_assets == asset_urls
@pytest.mark.parametrize(
- "params, expected_assets",
+ ("params", "expected_assets"),
[
({"uri_pattern": "s3"}, {"s3://folder/key"}),
({"uri_pattern": "bucket"}, {"gcp://bucket/key", "wasb://some_asset_bucket_/key"}),
@@ -562,7 +562,7 @@ class TestGetAssets(TestAssets):
asset_urls = {asset["uri"] for asset in response.json()["assets"]}
assert expected_assets == asset_urls
- @pytest.mark.parametrize("dag_ids, expected_num", [("dag1,dag2", 2), ("dag3", 1), ("dag2,dag3", 2)])
+ @pytest.mark.parametrize(("dag_ids", "expected_num"), [("dag1,dag2", 2), ("dag3", 1), ("dag2,dag3", 2)])
@provide_session
def test_filter_assets_by_dag_ids_works(
self, test_client, dag_ids, expected_num, testing_dag_bundle, session
@@ -599,7 +599,7 @@ class TestGetAssets(TestAssets):
assert len(response_data["assets"]) == expected_num
@pytest.mark.parametrize(
- "dag_ids, uri_pattern,expected_num",
+ ("dag_ids", "uri_pattern", "expected_num"),
[("dag1,dag2", "folder", 1), ("dag3", "nothing", 0), ("dag2,dag3", "key", 2)],
)
@provide_session
@@ -640,7 +640,7 @@ class TestGetAssets(TestAssets):
class TestGetAssetsEndpointPagination(TestAssets):
@pytest.mark.parametrize(
- "url, expected_asset_uris",
+ ("url", "expected_asset_uris"),
[
# Limit test data
("/assets?limit=1", ["s3://bucket/key/1"]),
@@ -721,7 +721,7 @@ class TestGetAssetAliases(TestAssetAliases):
assert response.json()["detail"] == msg
@pytest.mark.parametrize(
- "params, expected_asset_aliases",
+ ("params", "expected_asset_aliases"),
[
({"name_pattern": "foo"}, {"foo1"}),
({"name_pattern": "1"}, {"foo1", "bar12"}),
@@ -748,7 +748,7 @@ class TestGetAssetAliases(TestAssetAliases):
class TestGetAssetAliasesEndpointPagination(TestAssetAliases):
@pytest.mark.parametrize(
- "url, expected_asset_aliases",
+ ("url", "expected_asset_aliases"),
[
# Limit test data
("/assets/aliases?limit=1", ["simple1"]),
@@ -858,7 +858,7 @@ class TestGetAssetEvents(TestAssets):
assert response.status_code == 403
@pytest.mark.parametrize(
- "params, total_entries",
+ ("params", "total_entries"),
[
({"asset_id": "2"}, 1),
({"source_dag_id": "source_dag_id"}, 2),
@@ -881,7 +881,7 @@ class TestGetAssetEvents(TestAssets):
assert response.json()["total_entries"] == total_entries
@pytest.mark.parametrize(
- "params, expected_ids",
+ ("params", "expected_ids"),
[
# Test Case 1: Filtering with both timestamp_gte and timestamp_lte set to the same date
(
@@ -940,7 +940,7 @@ class TestGetAssetEvents(TestAssets):
assert response.json()["detail"] == msg
@pytest.mark.parametrize(
- "params, expected_asset_ids",
+ ("params", "expected_asset_ids"),
[
# Limit test data
({"limit": "1"}, [1]),
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_auth.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_auth.py
index 297e66e5ae8..548b16eb8be 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_auth.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_auth.py
@@ -76,7 +76,7 @@ class TestGetLogin(TestAuthEndpoint):
class TestLogout(TestAuthEndpoint):
@pytest.mark.parametrize(
- "mock_logout_url, expected_redirection, delete_cookies",
+ ("mock_logout_url", "expected_redirection", "delete_cookies"),
[
# logout_url is None, should redirect to the login page directly.
(None, AUTH_MANAGER_LOGIN_URL, True),
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
index cf064e9bcdc..6ff0a6e1519 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
@@ -194,7 +194,7 @@ class TestGetBackfill(TestBackfillEndpoint):
class TestCreateBackfill(TestBackfillEndpoint):
@pytest.mark.parametrize(
- "repro_act, repro_exp",
+ ("repro_act", "repro_exp"),
[
(None, ReprocessBehavior.NONE),
("none", ReprocessBehavior.NONE),
@@ -294,7 +294,7 @@ class TestCreateBackfill(TestBackfillEndpoint):
assert response.json().get("detail") == f"{dag.dag_id} has no schedule"
@pytest.mark.parametrize(
- "repro_act, repro_exp, run_backwards, status_code",
+ ("repro_act", "repro_exp", "run_backwards", "status_code"),
[
("none", ReprocessBehavior.NONE, False, 422),
("completed", ReprocessBehavior.COMPLETED, False, 200),
@@ -408,7 +408,7 @@ class TestCreateBackfill(TestBackfillEndpoint):
# todo: AIP-83 amendment must fix
@pytest.mark.parametrize(
- "reprocess_behavior, expected_dates",
+ ("reprocess_behavior", "expected_dates"),
[
(
"none",
@@ -585,7 +585,7 @@ class TestCreateBackfill(TestBackfillEndpoint):
class TestCreateBackfillDryRun(TestBackfillEndpoint):
@pytest.mark.parametrize(
- "reprocess_behavior, expected_dates",
+ ("reprocess_behavior", "expected_dates"),
[
(
"none",
@@ -670,7 +670,7 @@ class TestCreateBackfillDryRun(TestBackfillEndpoint):
assert response_json["backfills"] == expected_dates
@pytest.mark.parametrize(
- "repro_act, repro_exp, run_backwards, status_code",
+ ("repro_act", "repro_exp", "run_backwards", "status_code"),
[
("none", ReprocessBehavior.NONE, False, 422),
("completed", ReprocessBehavior.COMPLETED, False, 200),
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_config.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_config.py
index c057d2d32a7..9ceacd48ea4 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_config.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_config.py
@@ -181,7 +181,7 @@ class TestConfigEndpoint:
class TestGetConfig(TestConfigEndpoint):
@pytest.mark.parametrize(
- "section, headers, expected_status_code, expected_response",
+ ("section", "headers", "expected_status_code", "expected_response"),
[
(
None,
@@ -273,7 +273,7 @@ class TestGetConfig(TestConfigEndpoint):
self._validate_response(headers, expected_response, expected_status_code, response)
@pytest.mark.parametrize(
- "headers, expected_status_code, expected_response",
+ ("headers", "expected_status_code", "expected_response"),
[
(HEADERS_JSON, 200, GET_CONFIG_NON_SENSITIVE_ONLY_JSON_RESPONSE),
(HEADERS_JSON_UTF8, 200, GET_CONFIG_NON_SENSITIVE_ONLY_JSON_RESPONSE),
@@ -316,7 +316,7 @@ class TestGetConfig(TestConfigEndpoint):
class TestGetConfigValue(TestConfigEndpoint):
@pytest.mark.parametrize(
- "section, option, headers, expected_status_code, expected_response",
+ ("section", "option", "headers", "expected_status_code", "expected_response"),
[
(
SECTION_CORE,
@@ -430,7 +430,7 @@ class TestGetConfigValue(TestConfigEndpoint):
self._validate_response(headers, expected_response, expected_status_code, response)
@pytest.mark.parametrize(
- "section, option, headers, expected_status_code, expected_response",
+ ("section", "option", "headers", "expected_status_code", "expected_response"),
[
(
SECTION_DATABASE,
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_connections.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_connections.py
index ff1048efcce..628c19efd84 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_connections.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_connections.py
@@ -192,7 +192,7 @@ class TestGetConnection(TestConnectionEndpoint):
class TestGetConnections(TestConnectionEndpoint):
@pytest.mark.parametrize(
- "query_params, expected_total_entries, expected_ids",
+ ("query_params", "expected_total_entries", "expected_ids"),
[
# Filters
({}, 2, [TEST_CONN_ID, TEST_CONN_ID_2]),
@@ -329,7 +329,7 @@ class TestPostConnection(TestConnectionEndpoint):
@pytest.mark.enable_redact
@pytest.mark.parametrize(
- "body, expected_response",
+ ("body", "expected_response"),
[
(
{"connection_id": TEST_CONN_ID, "conn_type": TEST_CONN_TYPE, "password": "test-password"},
@@ -389,7 +389,7 @@ class TestPostConnection(TestConnectionEndpoint):
class TestPatchConnection(TestConnectionEndpoint):
@pytest.mark.parametrize(
- "body, expected_result",
+ ("body", "expected_result"),
[
(
{"connection_id": TEST_CONN_ID, "conn_type": "new_type", "extra": '{"key": "var"}'},
@@ -573,7 +573,7 @@ class TestPatchConnection(TestConnectionEndpoint):
assert response.status_code == 403
@pytest.mark.parametrize(
- "body, updated_connection, update_mask",
+ ("body", "updated_connection", "update_mask"),
[
(
{
@@ -804,7 +804,7 @@ class TestPatchConnection(TestConnectionEndpoint):
@pytest.mark.enable_redact
@pytest.mark.parametrize(
- "body, expected_response, update_mask",
+ ("body", "expected_response", "update_mask"),
[
(
{"connection_id": TEST_CONN_ID, "conn_type": TEST_CONN_TYPE, "password": "test-password"},
@@ -877,7 +877,7 @@ class TestConnection(TestConnectionEndpoint):
@mock.patch.dict(os.environ, {"AIRFLOW__CORE__TEST_CONNECTION": "Enabled"})
@pytest.mark.parametrize(
- "body, message",
+ ("body", "message"),
[
({"connection_id": TEST_CONN_ID, "conn_type": "sqlite"}, "Connection successfully tested"),
(
@@ -959,7 +959,7 @@ class TestCreateDefaultConnections(TestConnectionEndpoint):
class TestBulkConnections(TestConnectionEndpoint):
@pytest.mark.parametrize(
- "actions, expected_results",
+ ("actions", "expected_results"),
[
pytest.param(
{
@@ -1338,7 +1338,7 @@ class TestPostConnectionExtraBackwardCompatibility(TestConnectionEndpoint):
assert connection.extra == "{}" # Backward compatibility: treat "" as empty JSON object
@pytest.mark.parametrize(
- "extra, expected_error_message",
+ ("extra", "expected_error_message"),
[
("[1,2,3]", "Expected JSON object in `extra` field, got non-dict JSON"),
("some_string", "Encountered non-JSON in `extra` field"),
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py
index 3f8ddbe581a..cd7a0be4cf5 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py
@@ -264,7 +264,7 @@ def get_dag_run_dict(run: DagRun):
class TestGetDagRun:
@pytest.mark.parametrize(
- "dag_id, run_id, state, run_type, triggered_by, dag_run_note",
+ ("dag_id", "run_id", "state", "run_type", "triggered_by", "dag_run_note"),
[
(
DAG1_ID,
@@ -329,7 +329,7 @@ class TestGetDagRun:
class TestGetDagRuns:
@pytest.mark.parametrize(
- "dag_id, total_entries",
+ ("dag_id", "total_entries"),
[(DAG1_ID, 2), (DAG2_ID, 2), ("~", 4)],
)
@pytest.mark.usefixtures("configure_git_connection_for_dag_bundle")
@@ -371,7 +371,7 @@ class TestGetDagRuns:
assert response.status_code == 403
@pytest.mark.parametrize(
- "order_by,expected_order",
+ ("order_by", "expected_order"),
[
pytest.param("id", [DAG1_RUN1_ID, DAG1_RUN2_ID], id="order_by_id"),
pytest.param("state", [DAG1_RUN2_ID, DAG1_RUN1_ID], id="order_by_state"),
@@ -405,7 +405,7 @@ class TestGetDagRuns:
assert [each["dag_run_id"] for each in body["dag_runs"]] == expected_order[::-1]
@pytest.mark.parametrize(
- "query_params, expected_dag_id_order",
+ ("query_params", "expected_dag_id_order"),
[
({}, [DAG1_RUN1_ID, DAG1_RUN2_ID]),
({"limit": 1}, [DAG1_RUN1_ID]),
@@ -425,7 +425,7 @@ class TestGetDagRuns:
assert [each["dag_run_id"] for each in body["dag_runs"]] == expected_dag_id_order
@pytest.mark.parametrize(
- "query_params, expected_detail",
+ ("query_params", "expected_detail"),
[
(
{"limit": 1, "offset": -1},
@@ -478,7 +478,7 @@ class TestGetDagRuns:
assert response.json()["detail"] == expected_detail
@pytest.mark.parametrize(
- "dag_id, query_params, expected_dag_id_list",
+ ("dag_id", "query_params", "expected_dag_id_list"),
[
(
DAG1_ID,
@@ -847,7 +847,7 @@ class TestListDagRunsBatch:
]
@pytest.mark.parametrize(
- "dag_ids, status_code, expected_dag_id_list",
+ ("dag_ids", "status_code", "expected_dag_id_list"),
[
([], 200, DAG_RUNS_LIST),
([DAG1_ID], 200, [DAG1_RUN1_ID, DAG1_RUN2_ID]),
@@ -871,7 +871,7 @@ class TestListDagRunsBatch:
)
@pytest.mark.parametrize(
- "order_by,expected_order",
+ ("order_by", "expected_order"),
[
pytest.param("id", DAG_RUNS_LIST, id="order_by_id"),
pytest.param(
@@ -904,7 +904,7 @@ class TestListDagRunsBatch:
assert [run["dag_run_id"] for run in body["dag_runs"]] == expected_order[::-1]
@pytest.mark.parametrize(
- "post_body, expected_dag_id_order",
+ ("post_body", "expected_dag_id_order"),
[
({}, DAG_RUNS_LIST),
({"page_limit": 1}, DAG_RUNS_LIST[:1]),
@@ -924,7 +924,7 @@ class TestListDagRunsBatch:
assert [each["dag_run_id"] for each in body["dag_runs"]] == expected_dag_id_order
@pytest.mark.parametrize(
- "post_body, expected_detail",
+ ("post_body", "expected_detail"),
[
(
{"page_limit": 1, "page_offset": -1},
@@ -977,7 +977,7 @@ class TestListDagRunsBatch:
assert response.json()["detail"] == expected_detail
@pytest.mark.parametrize(
- "post_body, expected_dag_id_list",
+ ("post_body", "expected_dag_id_list"),
[
(
{"logical_date_gte": LOGICAL_DATE1.isoformat()},
@@ -1108,7 +1108,7 @@ class TestListDagRunsBatch:
assert body["detail"] == expected_detail
@pytest.mark.parametrize(
- "post_body, expected_response",
+ ("post_body", "expected_response"),
[
(
{"states": ["invalid"]},
@@ -1143,7 +1143,7 @@ class TestListDagRunsBatch:
class TestPatchDagRun:
@pytest.mark.parametrize(
- "dag_id, run_id, patch_body, response_body, note_data",
+ ("dag_id", "run_id", "patch_body", "response_body", "note_data"),
[
(
DAG1_ID,
@@ -1211,7 +1211,7 @@ class TestPatchDagRun:
assert response.status_code == 403
@pytest.mark.parametrize(
- "query_params, patch_body, response_body, expected_status_code, note_data",
+ ("query_params", "patch_body", "response_body", "expected_status_code", "note_data"),
[
(
{"update_mask": ["state"]},
@@ -1294,7 +1294,7 @@ class TestPatchDagRun:
get_listener_manager().clear()
@pytest.mark.parametrize(
- "state, listener_state",
+ ("state", "listener_state"),
[
("queued", []),
("success", [DagRunState.SUCCESS]),
@@ -1455,7 +1455,7 @@ class TestClearDagRun:
assert response.status_code == 403
@pytest.mark.parametrize(
- "body, dag_run_id, expected_state",
+ ("body", "dag_run_id", "expected_state"),
[
[{"dry_run": True}, DAG1_RUN1_ID, ["success", "success"]],
[{}, DAG1_RUN1_ID, ["success", "success"]],
@@ -1525,7 +1525,7 @@ class TestTriggerDagRun:
@time_machine.travel(timezone.utcnow(), tick=False)
@pytest.mark.parametrize(
- "dag_run_id, note, data_interval_start, data_interval_end, note_data",
+ ("dag_run_id", "note", "data_interval_start", "data_interval_end", "note_data"),
[
("dag_run_5", "test-note", None, None, {"user_id": "test", "content": "test-note"}),
(
@@ -1618,7 +1618,7 @@ class TestTriggerDagRun:
assert response.status_code == 403
@pytest.mark.parametrize(
- "post_body, expected_detail",
+ ("post_body", "expected_detail"),
[
(
{"executiondate": "2020-11-10T08:25:56Z"},
@@ -1793,7 +1793,7 @@ class TestTriggerDagRun:
assert response_2.status_code == 409
@pytest.mark.parametrize(
- "data_interval_start, data_interval_end",
+ ("data_interval_start", "data_interval_end"),
[
(
LOGICAL_DATE1.isoformat(),
@@ -1953,7 +1953,7 @@ class TestWaitDagRun:
assert response.status_code == 422
@pytest.mark.parametrize(
- "run_id, state",
+ ("run_id", "state"),
[(DAG1_RUN1_ID, DAG1_RUN1_STATE), (DAG1_RUN2_ID, DAG1_RUN2_STATE)],
)
def test_should_respond_200_immediately_for_finished_run(self, test_client, run_id, state):
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_stats.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_stats.py
index 6f16829e8c4..36d327528be 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_stats.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_stats.py
@@ -291,7 +291,7 @@ class TestGetDagStats(TestDagStatsEndpoint):
assert res_json == exp_payload
@pytest.mark.parametrize(
- "url, params, exp_payload",
+ ("url", "params", "exp_payload"),
[
(
API_PREFIX,
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_tags.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_tags.py
index 60d07131e97..8c7b00b035a 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_tags.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_tags.py
@@ -149,7 +149,7 @@ class TestDagTags(TestDagEndpoint):
"""Unit tests for Get DAG Tags."""
@pytest.mark.parametrize(
- "query_params, expected_status_code, expected_dag_tags, expected_total_entries",
+ ("query_params", "expected_status_code", "expected_dag_tags", "expected_total_entries"),
[
# test with offset, limit, and without any tag_name_pattern
(
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_versions.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_versions.py
index 85135932063..a2ae5dc7ef0 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_versions.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_versions.py
@@ -44,7 +44,7 @@ class TestDagVersionEndpoint:
class TestGetDagVersion(TestDagVersionEndpoint):
@pytest.mark.parametrize(
- "dag_id, dag_version, expected_response",
+ ("dag_id", "dag_version", "expected_response"),
[
[
"ANOTHER_DAG_ID",
@@ -111,7 +111,7 @@ class TestGetDagVersion(TestDagVersionEndpoint):
assert response.json() == expected_response
@pytest.mark.parametrize(
- "dag_id, dag_version, expected_response",
+ ("dag_id", "dag_version", "expected_response"),
[
[
"ANOTHER_DAG_ID",
@@ -213,7 +213,7 @@ class TestGetDagVersion(TestDagVersionEndpoint):
class TestGetDagVersions(TestDagVersionEndpoint):
@pytest.mark.parametrize(
- "dag_id, expected_response, expected_query_count",
+ ("dag_id", "expected_response", "expected_query_count"),
[
[
"~",
@@ -317,7 +317,7 @@ class TestGetDagVersions(TestDagVersionEndpoint):
assert response.json() == expected_response
@pytest.mark.parametrize(
- "dag_id, expected_response, expected_query_count",
+ ("dag_id", "expected_response", "expected_query_count"),
[
[
"~",
@@ -419,7 +419,7 @@ class TestGetDagVersions(TestDagVersionEndpoint):
assert response.json() == expected_response
@pytest.mark.parametrize(
- "params, expected_versions, expected_total_entries",
+ ("params", "expected_versions", "expected_total_entries"),
[
[{"limit": 1}, [("ANOTHER_DAG_ID", 1)], 4],
[{"limit": 2}, [("ANOTHER_DAG_ID", 1), ("dag_with_multiple_versions", 1)], 4],
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_warning.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_warning.py
index 45f08f95d1e..287245127f8 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_warning.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_warning.py
@@ -71,7 +71,7 @@ def setup(dag_maker, testing_dag_bundle, session=None) -> None:
class TestGetDagWarnings:
@pytest.mark.parametrize(
- "query_params, expected_total_entries, expected_messages",
+ ("query_params", "expected_total_entries", "expected_messages"),
[
({}, 3, [DAG1_MESSAGE, DAG2_MESSAGE, DAG3_MESSAGE]),
({"dag_id": DAG1_ID}, 1, [DAG1_MESSAGE]),
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py
index 198c0fa5d3f..a1e790a167f 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py
@@ -245,7 +245,7 @@ class TestGetDags(TestDagEndpoint):
"""Unit tests for Get DAGs."""
@pytest.mark.parametrize(
- "query_params, expected_total_entries, expected_ids",
+ ("query_params", "expected_total_entries", "expected_ids"),
[
# Filters
({}, 2, [DAG1_ID, DAG2_ID]),
@@ -463,7 +463,7 @@ class TestGetDags(TestDagEndpoint):
assert [dag["dag_id"] for dag in body["dags"]] == [DAG1_ID, DAG2_ID]
@pytest.mark.parametrize(
- "setup_favorites, expected_total_entries, expected_ids",
+ ("setup_favorites", "expected_total_entries", "expected_ids"),
[
([], 0, []),
([DAG1_ID], 1, [DAG1_ID]),
@@ -509,7 +509,7 @@ class TestGetDags(TestDagEndpoint):
assert response.status_code == 403
@pytest.mark.parametrize(
- "filter_value, expected_ids",
+ ("filter_value", "expected_ids"),
[
(True, [DAG1_ID]),
(False, [DAG2_ID]),
@@ -596,7 +596,15 @@ class TestPatchDag(TestDagEndpoint):
"""Unit tests for Patch DAG."""
@pytest.mark.parametrize(
- "query_params, dag_id, body, expected_status_code, expected_is_paused, expected_tags, expected_display_name",
+ (
+ "query_params",
+ "dag_id",
+ "body",
+ "expected_status_code",
+ "expected_is_paused",
+ "expected_tags",
+ "expected_display_name",
+ ),
[
({}, "fake_dag_id", {"is_paused": True}, 404, None, [], "fake_dag_display_name"),
(
@@ -686,7 +694,7 @@ class TestPatchDags(TestDagEndpoint):
"""Unit tests for Patch DAGs."""
@pytest.mark.parametrize(
- "query_params, body, expected_status_code, expected_ids, expected_paused_ids",
+ ("query_params", "body", "expected_status_code", "expected_ids", "expected_paused_ids"),
[
({"update_mask": ["field_1", "is_paused"]}, {"is_paused": True}, 400, None, None),
(
@@ -771,7 +779,7 @@ class TestFavoriteDag(TestDagEndpoint):
"""Unit tests for favoriting a DAG."""
@pytest.mark.parametrize(
- "dag_id, expected_status_code, expected_exist_in_favorites",
+ ("dag_id", "expected_status_code", "expected_exist_in_favorites"),
[
("fake_dag_id", 404, None),
(DAG1_ID, 204, True),
@@ -810,7 +818,7 @@ class TestUnfavoriteDag(TestDagEndpoint):
"""Unit tests for unfavoriting a DAG."""
@pytest.mark.parametrize(
- "dag_id, expected_status_code, expected_exist_in_favorites",
+ ("dag_id", "expected_status_code", "expected_exist_in_favorites"),
[
("fake_dag_id", 404, None),
(DAG1_ID, 204, False),
@@ -850,7 +858,15 @@ class TestDagDetails(TestDagEndpoint):
"""Unit tests for DAG Details."""
@pytest.mark.parametrize(
- "query_params, dag_id, expected_status_code, dag_display_name, start_date, owner_links, last_parse_duration",
+ (
+ "query_params",
+ "dag_id",
+ "expected_status_code",
+ "dag_display_name",
+ "start_date",
+ "owner_links",
+ "last_parse_duration",
+ ),
[
({}, "fake_dag_id", 404, "fake_dag", "2023-12-31T00:00:00Z", {}, None),
({}, DAG2_ID, 200, DAG2_ID, "2021-06-15T00:00:00Z", {}, 0.24),
@@ -942,7 +958,7 @@ class TestDagDetails(TestDagEndpoint):
assert res_json == expected
@pytest.mark.parametrize(
- "query_params, dag_id, expected_status_code, dag_display_name, start_date, owner_links",
+ ("query_params", "dag_id", "expected_status_code", "dag_display_name", "start_date", "owner_links"),
[
({}, "fake_dag_id", 404, "fake_dag", "2023-12-31T00:00:00Z", {}),
({}, DAG2_ID, 200, DAG2_ID, "2021-06-15T00:00:00Z", {}),
@@ -1067,7 +1083,7 @@ class TestGetDag(TestDagEndpoint):
"""Unit tests for Get DAG."""
@pytest.mark.parametrize(
- "query_params, dag_id, expected_status_code, dag_display_name, expected_tags",
+ ("query_params", "dag_id", "expected_status_code", "dag_display_name", "expected_tags"),
[
({}, "fake_dag_id", 404, "fake_dag", []),
({}, DAG2_ID, 200, DAG2_ID, []),
@@ -1159,7 +1175,14 @@ class TestDeleteDAG(TestDagEndpoint):
dag_maker.sync_dagbag_to_db()
@pytest.mark.parametrize(
- "dag_id, dag_display_name, status_code_delete, status_code_details, has_running_dagruns, is_create_dag",
+ (
+ "dag_id",
+ "dag_display_name",
+ "status_code_delete",
+ "status_code_details",
+ "has_running_dagruns",
+ "is_create_dag",
+ ),
[
("test_nonexistent_dag_id", "nonexistent_display_name", 404, 404, False, False),
(DAG4_ID, DAG4_DISPLAY_NAME, 204, 404, False, True),