Skip to content
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

Improve code coverage for TriggerRuleDep #37680

Merged

Conversation

stevenschaerer
Copy link
Contributor

related: #35127

This PR improves the test coverage of the trigger_rule_dep.py module and increases code coverage from 91% to 99%. It also removes an unreachable code fragment (upstream_setup used to be of type int | None, but now only int) and adds some missing whitespaces to one of the failure reasons. I believe that the 3 lines that are still not covered (184, 208, 214) can't be reached without nested mapped tasks which are currently not supported.

While the pure code coverage could have been improved by only adding a couple of tests, test_trigger_rule_dep.py actually only covered 85% of trigger_rule_dep.py, with the additional misses mainly coming from the flag_upstream_failed == True branch. There was also a chance of tests accidentally succeeding since the failure reason was often not validated (this happened in test_always_tr). For these reasons I opted to extend many of the existing tests. Generally this meant testing flag_upstream_failed being true and false as well as validating the resulting ti state.

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice set of tests. Thanks for being so dilligent :)

@potiuk potiuk merged commit 73a632a into apache:main Mar 2, 2024
59 checks passed
Copy link

boring-cyborg bot commented Mar 2, 2024

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@utkarsharma2 utkarsharma2 added this to the Airflow 2.8.3 milestone Mar 6, 2024
@utkarsharma2 utkarsharma2 added the type:misc/internal Changelog: Misc changes that should appear in change log label Mar 6, 2024
ephraimbuddy pushed a commit that referenced this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:misc/internal Changelog: Misc changes that should appear in change log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants