-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix help message display for dags test subcommand #8552
Conversation
Can you add test to avoid regression? I think something similar to the one below is enough.
def test_should_display_helps(self):
parser = cli_parser.get_parser()
all_command_as_args = sum([
[[top_commaand.name]]
if isinstance(top_commaand, cli_parser.ActionCommand)
else [
[top_commaand.name, nested_command.name] for nested_command in top_commaand.subcommands
]
for top_commaand in cli_parser.airflow_commands
], [])
for cmd_args in all_command_as_args:
with self.assertRaises(SystemExit):
parser.parse_args([*cmd_args, '--help']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM, but still need add test as Kamil said
BTW, Kamil test is awesome. |
FYI flat map suggest by Kamil isn't best in terms of performance but it doesn't matter here probably. |
Nice blog post @turbaszek |
I merged it too quick - did not notice the last comment but indeed @hoqp -> tests would be awesome :) |
follow up for PR apache#8552.
@mik-laj @zhongjiajie @potiuk please see PR #8561 for unit test. Also thanks @turbaszek for the optimization tip. Like you said not going to matter in this case, but it's good to know. I changed mik-laj's implementation to use nested list comprehension based on the blog post you shared. |
Without this fix,
airflow dags test
crashes with the following error:Make sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.