uranusjr commented on a change in pull request #20411:
URL: https://github.com/apache/airflow/pull/20411#discussion_r773693784



##########
File path: tests/models/test_skipmixin.py
##########
@@ -117,3 +118,28 @@ def get_state(ti):
 
         assert get_state(ti2) == State.NONE
         assert get_state(ti3) == State.SKIPPED
+
+    @pytest.mark.parametrize("branch_task_ids", [None, []])
+    def test_skip_all_except_none(self, dag_maker, branch_task_ids):

Review comment:
       You can merge this into `test_skip_all_except` if you also parametrise 
the expected states:
   
   ```python
   @pytest.mark.parametrize(
       "branch_task_ids, expected_states",
       [
           (["task2"], {"task2": State.NONE, "task3": State.SKIPPED}),
           ("task2", {"task2": State.NONE, "task3": State.SKIPPED}),
           (None, {"task2": State.SKIPPED, "task3": State.SKIPPED}),
           ([], {"task2": State.SKIPPED, "task3": State.SKIPPED}),
       ],
   )
   def test_skip_except(branch_task_ids, expected_states, [others fixtures...]):
       ...
   
       task_instances = {
           "task1": TI(task1, ...),
           "task2": TI(task2, ...),
           "task3": TI(task3, ...),
       }
   
       SkipMixin().skip_all_except(ti=ti1, branch_task_ids=branch_task_ids)
   
       ...
   
       executed_states = {
           task_id: get_state(task_instances[task_id])
           for task_id in expected_states
       }
       assert executed_states == expected_states
   ```




-- 
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