This is an automated email from the ASF dual-hosted git repository.
henry3260 pushed a commit to branch v3-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-3-test by this push:
new bc90f53bfc6 [v3-3-test] Stop airflow providers get --full mutating
cached provider metadata (#72346) (#72601)
bc90f53bfc6 is described below
commit bc90f53bfc68f44ccda45643ca5fd8cf14ac44ba
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Sep 7 02:42:59 2026 +0800
[v3-3-test] Stop airflow providers get --full mutating cached provider
metadata (#72346) (#72601)
---
.../src/airflow/cli/commands/provider_command.py | 3 +-
.../unit/cli/commands/test_provider_command.py | 59 ++++++++++++++++++++++
2 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/airflow-core/src/airflow/cli/commands/provider_command.py
b/airflow-core/src/airflow/cli/commands/provider_command.py
index fa24b8bb8b8..9f59b803323 100644
--- a/airflow-core/src/airflow/cli/commands/provider_command.py
+++ b/airflow-core/src/airflow/cli/commands/provider_command.py
@@ -44,9 +44,8 @@ def provider_get(args):
provider_version = providers[args.provider_name].version
provider_info = providers[args.provider_name].data
if args.full:
- provider_info["description"] =
_remove_rst_syntax(provider_info["description"])
AirflowConsole().print_as(
- data=[provider_info],
+ data=[{**provider_info, "description":
_remove_rst_syntax(provider_info["description"])}],
output=args.output,
)
else:
diff --git a/airflow-core/tests/unit/cli/commands/test_provider_command.py
b/airflow-core/tests/unit/cli/commands/test_provider_command.py
new file mode 100644
index 00000000000..9f5db24a6ce
--- /dev/null
+++ b/airflow-core/tests/unit/cli/commands/test_provider_command.py
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from unittest import mock
+
+import pytest
+
+from airflow.cli import cli_parser
+from airflow.cli.commands import provider_command
+from airflow.providers_manager import ProviderInfo
+
+RST_DESCRIPTION = "`Apache Beam <https://beam.apache.org/>`__.\n"
+PLAIN_DESCRIPTION = "Apache Beam https://beam.apache.org/"
+
+
+class TestCliProviderGet:
+ @classmethod
+ def setup_class(cls):
+ cls.parser = cli_parser.get_parser()
+
+ @pytest.fixture
+ def provider_info(self):
+ return ProviderInfo(
+ version="1.0.0",
+ data={"package-name": "apache-airflow-providers-beam",
"description": RST_DESCRIPTION},
+ )
+
+ @mock.patch("airflow.cli.commands.provider_command.AirflowConsole",
autospec=True)
+ @mock.patch("airflow.cli.commands.provider_command.ProvidersManager",
autospec=True)
+ def test_provider_get_full_keeps_providers_manager_data_intact(
+ self, mock_providers_manager, mock_console, provider_info
+ ):
+ mock_providers_manager.return_value.providers = {
+ "apache-airflow-providers-beam": provider_info,
+ }
+
+ provider_command.provider_get(
+ self.parser.parse_args(["providers", "get",
"apache-airflow-providers-beam", "--full"])
+ )
+
+ assert mock_console.return_value.print_as.call_args.kwargs["data"] == [
+ {"package-name": "apache-airflow-providers-beam", "description":
PLAIN_DESCRIPTION}
+ ]
+ assert provider_info.data["description"] == RST_DESCRIPTION