This is an automated email from the ASF dual-hosted git repository.

shahar1 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 9c164b5891f Fix airflowctl required-option test broken by concurrent 
merges (#76092)
9c164b5891f is described below

commit 9c164b5891f66a96a6bf886c8fa815e12c21394c
Author: Shahar Epstein <[email protected]>
AuthorDate: Sat Oct 31 09:12:10 2026 +0200

    Fix airflowctl required-option test broken by concurrent merges (#76092)
    
    #69317 made required request-body fields required in argparse, and
    #75177 added a test expecting the post-parse validation to report a
    missing --conn-type. Each passed on its own, but together argparse
    rejects the command during parsing, so the test failed on main. The
    argparse error is the intended behaviour; the test now checks it.
---
 airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py 
b/airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py
index 70d537c7076..1078540f3f1 100644
--- a/airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py
+++ b/airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py
@@ -1203,19 +1203,15 @@ class TestCliConfigMethods:
         assert "--port" in message
         assert "required" not in message
 
-    def 
test_create_command_without_required_option_exits_with_friendly_message(self):
-        """Test ``connections create`` without --conn-type exits cleanly and 
never calls the API."""
+    def 
test_create_command_without_required_option_is_rejected_by_parser(self, capsys):
+        """Test argparse rejects ``connections create`` without --conn-type: 
exit code 2, message on stderr."""
         parser = cli_parser.get_parser()
-        args = parser.parse_args(
-            ["connections", "create", "--api-token", "token", 
"--connection-id", "my_conn"]
-        )
 
-        with mock.patch.object(ConnectionsOperations, "create") as mock_create:
-            with pytest.raises(SystemExit) as ctx:
-                args.func(args)
+        with pytest.raises(SystemExit) as ctx:
+            parser.parse_args(["connections", "create", "--api-token", 
"token", "--connection-id", "my_conn"])
 
-        assert "the following arguments are required: --conn-type" in 
str(ctx.value)
-        mock_create.assert_not_called()
+        assert ctx.value.code == 2
+        assert "the following arguments are required: --conn-type" in 
capsys.readouterr().err
 
     @pytest.mark.parametrize(
         ("group_name", "subcommand_name", "expected_help"),

Reply via email to