def METHOD_NAME(parser, args, unknown_args):
    global pytest
    import spack.bootstrap
    # Ensure clingo is available before switching to the
    # mock configuration used by unit tests
    # Note: skip on windows here because for the moment,
    # clingo is wholly unsupported from bootstrap
    with spack.bootstrap.ensure_bootstrap_configuration():
        spack.bootstrap.ensure_core_dependencies()
        if pytest is None:
            spack.bootstrap.ensure_environment_dependencies()
            import pytest
    if args.pytest_help:
        # make the pytest.main help output more accurate
        sys.argv[0] = "spack unit-test"
        return pytest.main(["-h"])
    # add back any parsed pytest args we need to pass to pytest
    pytest_args = add_back_pytest_args(args, unknown_args)
    # The default is to test the core of Spack. If the option `--extension`
    # has been used, then test that extension.
    pytest_root = spack.paths.spack_root
    if args.extension:
        target = args.extension
        extensions = spack.extensions.get_extension_paths()
        pytest_root = spack.extensions.path_for_extension(target, *extensions)
    # pytest.ini lives in the root of the spack repository.
    with llnl.util.filesystem.working_dir(pytest_root):
        if args.list:
            do_list(args, pytest_args)
            return
        return pytest.main(pytest_args)