def METHOD_NAME(cmd, args=None):
    """Assert that a block of code runs the given command.
    If args is passed, also check that it was called at least once with the
    given arguments (not including the command name).
    Use as a context manager, e.g.::
        with assert_calls('git'):
            some_function_wrapping_git()
        with assert_calls('git', ['add', myfile]):
            some_other_function()
    """
    with MockCommand(cmd) as mc:
        yield
    mc.assert_called(args=args)