def METHOD_NAME(args, extra_args):
    """Print a lists of tests than what pytest offers."""
    def colorize(c, prefix):
        if isinstance(prefix, tuple):
            return "::".join(color.colorize("@%s{%s}" % (c, p)) for p in prefix if p != "()")
        return color.colorize("@%s{%s}" % (c, prefix))
    # To list the files we just need to inspect the filesystem,
    # which doesn't need to wait for pytest collection and doesn't
    # require parsing pytest output
    files = llnl.util.filesystem.find(root=spack.paths.test_path, files="*.py", recursive=True)
    files = [
        os.path.relpath(f, start=spack.paths.spack_root)
        for f in files
        if not f.endswith(("conftest.py", "__init__.py"))
    ]
    old_output = sys.stdout
    try:
        sys.stdout = output = io.StringIO()
        pytest.main(["--collect-only"] + extra_args)
    finally:
        sys.stdout = old_output
    lines = output.getvalue().split("\n")
    tests = collections.defaultdict(set)
    # collect tests into sections
    node_regexp = re.compile(r"(\s*)<([^ ]*) ['\"]?([^']*)['\"]?>")
    key_parts, name_parts = [], []
    for line in lines:
        match = node_regexp.match(line)
        if not match:
            continue
        indent, nodetype, name = match.groups()
        # strip parametrized tests
        if "[" in name:
            name = name[: name.index("[")]
        len_indent = len(indent)
        if os.path.isabs(name):
            name = os.path.relpath(name, start=spack.paths.spack_root)
        item = (len_indent, name, nodetype)
        # Reduce the parts to the scopes that are of interest
        name_parts = [x for x in name_parts if x[0] < len_indent]
        key_parts = [x for x in key_parts if x[0] < len_indent]
        # From version 3.X to version 6.X the output format
        # changed a lot in pytest, and probably will change
        # in the future - so this manipulation might be fragile
        if nodetype.lower() == "function":
            name_parts.append(item)
            key_end = os.path.join(*key_parts[-1][1].split("/"))
            key = next(f for f in files if f.endswith(key_end))
            tests[key].add(tuple(x[1] for x in name_parts))
        elif nodetype.lower() == "class":
            name_parts.append(item)
        elif nodetype.lower() in ("package", "module"):
            key_parts.append(item)
    if args.list == "list":
        files = set(tests.keys())
        color_files = [colorize("B", file) for file in sorted(files)]
        colify(color_files)
    elif args.list == "long":
        for prefix, functions in sorted(tests.items()):
            path = colorize("*B", prefix) + "::"
            functions = [colorize("c", f) for f in sorted(functions)]
            color.cprint(path)
            colify(functions, indent=4)
            print()
    else:  # args.list == "names"
        all_functions = [
            colorize("*B", prefix) + "::" + colorize("c", f)
            for prefix, functions in sorted(tests.items())
            for f in sorted(functions)
        ]
        colify(all_functions)