

def test_command_must_not_execute_after_tasks_in_case_of_failure(self):

    class FailureCommand(NamedCommand):

        def __init__(self, lizy):
            super(FailureCommand, self).__init__(lizy, 'desc')

        def _process_command(self, lizy, args):
            raise PyleaseError()
    before = MagicMock()
    after = MagicMock()
    lizy = MagicMock()
    args = MagicMock()
    info_container = InfoContainer()
    info_container.is_empty = False
    lizy.info_container = info_container
    sc = FailureCommand(lizy)
    sc.add_before_task(before)
    sc.add_after_task(after)
    sc(args)
    before.assert_called_once_with(lizy, args)
    ok_((not args.called))

dataset/ETHPy150Open n9code/pylease/tests/test_command.py CommandTest.test_command_must_not_execute_after_tasks_in_case_of_failure/VarMisuse@146/207 `after`->`args`