shahar1 opened a new pull request, #76092:
URL: https://github.com/apache/airflow/pull/76092

   `test_create_command_without_required_option_exits_with_friendly_message` 
fails on `main`:
   
   ```
   argparse.ArgumentError: the following arguments are required: --conn-type
   ```
   
   #69317 and #75177 merged 14 minutes apart and each was green on its own:
   - #69317 makes required, non-nullable request-body fields required in 
argparse.
   - #75177 added a test that parses `connections create --connection-id 
my_conn` (no `--conn-type`) outside `pytest.raises`, expecting 
`_validate_datamodel` to report the missing field after parsing.
   
   Together, argparse rejects the command while parsing, so the test fails 
before it reaches its assertion.
   
   The product behaviour is fine: `airflowctl connections create 
--connection-id x` exits with code 2 and `command error: the following 
arguments are required: --conn-type, see help above.`, with no traceback and no 
request sent. So only the test changes: it now asserts that the parser rejects 
the command, with exit code 2 and the message on stderr. If `--conn-type` stops 
being required in argparse, the test fails. `_validate_datamodel` keeps its 
direct unit tests from #75177, and its invalid-value path is still reachable 
from the CLI.
   
   Its "missing required" branch can no longer be reached from any generated 
command, because argparse rejects those first. It stays as a fallback; this PR 
leaves it alone.
   
   Not for `airflow-ctl/v0-1-test`: that branch has #75177 (via #76089) but not 
#69317, so the old test passes there and this one would fail.
   
   **Testing**: `pytest airflow-ctl/tests`: 700 passed. `prek run 
mypy-airflow-ctl --all-files` and the commit's prek hooks passed.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5, Sonnet 5.5)
   
   Generated-by: Claude Code (Opus 5.5, Sonnet 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to