def _binderhub_config():
    """Load the binderhub configuration

    Currently separate from the app fixture
    so that it can have a different scope (only once per session).
    """
    cfg = PyFileConfigLoader(binderhub_config_path).load_config()
    global K8S_AVAILABLE
    global K8S_NAMESPACE
    try:
        kubernetes.config.load_kube_config()
    except Exception:
        cfg.BinderHub.builder_required = False
        K8S_AVAILABLE = False
        K8S_NAMESPACE = None
    else:
        K8S_AVAILABLE = True
        # get the current context's namespace or assume it is "default"
        K8S_NAMESPACE = (
            subprocess.check_output(
                [
                    "kubectl",
                    "config",
                    "view",
                    "--minify",
                    "--output",
                    "jsonpath={..namespace}",
                ],
                text=True,
            ).strip()
            or "default"
        )

    if REMOTE_BINDER:
        return

    # check if Hub is running and ready
    try:
        requests.get(cfg.BinderHub.hub_url, timeout=5, allow_redirects=False)
    except Exception as e:
        print(f"JupyterHub not available at {cfg.BinderHub.hub_url}: {e}")
        cfg.BinderHub.hub_url = ""
    else:
        print(f"JupyterHub available at {cfg.BinderHub.hub_url}")
    return cfg
Load the binderhub configuration

    Currently separate from the app fixture
    so that it can have a different scope (only once per session).
    
binderhub/tests/conftest.py