def METHOD_NAME(image_dir, args=None, descriptor=None):
    if args is None:
        args = ["build", "--dry-run", "docker"]
    if descriptor is None:
        descriptor = image_descriptor
    with Chdir(image_dir):
        with open("image.yaml", "w") as fd:
            yaml.dump(descriptor, fd, default_flow_style=False)
        result = CliRunner().invoke(cli, args, catch_exceptions=False)
        sys.stdout.write("\n")
        sys.stdout.write(result.output)
        assert result.exit_code == 0
        return result