Task command has a few missing commands not tested: https://codecov.io/gh/apache/airflow/src/master/airflow/cli/commands/task_command.py (77%)

tests/cli/commands/test_task_command.py
"""Verify that the taskinstance has the right context for log_filename_template"""
        with mock.patch.object(task_command, "_run_task_by_selected_method"):
            with conf_vars({('core', 'dags_folder'): self.dag_path}):
                
                dag = DagBag().get_dag(self.dag_id)
                task = dag.get_task(self.task_id)
                with create_session() as session:
                    dag.create_dagrun(
                        execution_date=self.execution_date,
                        start_date=timezone.utcnow(),
                        state=State.RUNNING,
                        run_type=DagRunType.MANUAL,
                        session=session,
                    )
                    ti = TaskInstance(task, self.execution_date)
                    ti.refresh_from_db(session=session, lock_for_update=True)
                    ti.try_number = 1  
                    session.merge(ti)
                log_file_path = os.path.join(os.path.dirname(self.ti_log_file_path), "2.log")
                try:
                    task_command.task_run(self.parser.parse_args(self.task_args))
                    assert os.path.exists(log_file_path)
                finally:
                    try:
                        os.remove(log_file_path)
                    except OSError:
                        pass
    @mock.patch.object(task_command, "_run_task_by_selected_method")
    def test_root_logger_restored(self, run_task_mock):