Improve code coverage for TriggerRuleDep #37680
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 typeint | None
, but now onlyint
) 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 theflag_upstream_failed == True
branch. There was also a chance of tests accidentally succeeding since the failure reason was often not validated (this happened intest_always_tr
). For these reasons I opted to extend many of the existing tests. Generally this meant testingflag_upstream_failed
being true and false as well as validating the resulting ti state.