def app(request, io_loop, _binderhub_config):
    """Launch the BinderHub app

    Currently reads minikube test config from the repo.
    TODO: support input of test config files.

    Detects whether kubernetes is available, and if not disables build.
    Detects whether jupyterhub is available, and if not disables launch.

    app.url will contain the base URL of binderhub.
    """
    if REMOTE_BINDER:
        app = RemoteBinderHub()
        # wait for the remote binder to be up
        remaining = 30
        deadline = time.monotonic() + remaining
        success = False
        last_error = None
        while remaining:
            try:
                requests.get(BINDER_URL, timeout=remaining)
            except Exception as e:
                print(f"Waiting for binder: {e}")
                last_error = e
                time.sleep(1)
                remaining = deadline - time.monotonic()
            else:
                success = True
                break
        if not success:
            raise last_error
        app.url = BINDER_URL
        app._configured_bhub = BinderHub(config=_binderhub_config)
        return app

    api_only_app = False
    if hasattr(request, "param"):
        if request.param == "app_with_auth_config":
            # load conf for auth test
            cfg = PyFileConfigLoader(binderhub_config_auth_additions_path).load_config()
            _binderhub_config.merge(cfg)
        elif request.param == "api_only_app":
            # load conf that sets BinderHub.enable_api_only_mode = True
            cfg = Config({"BinderHub": {"enable_api_only_mode": True}})
            _binderhub_config.merge(cfg)
            api_only_app = True

    if not api_only_app:
        # load conf that sets BinderHub.require_build_only = False
        # otherwise because _binderhub_config has a session scope,
        # any previous set of require_build_only to True will stick around
        cfg = Config({"BinderHub": {"enable_api_only_mode": False}})
        _binderhub_config.merge(cfg)

    bhub = BinderHub.instance(config=_binderhub_config)
    bhub.initialize([])
    bhub.start(run_loop=False)
    # instantiating binderhub configures this
    # override again
    AsyncHTTPClient.configure(MockAsyncHTTPClient)

    def cleanup():
        bhub.stop()
        BinderHub.clear_instance()

    request.addfinalizer(cleanup)
    # convenience for accessing binder in tests
    bhub.url = f"http://127.0.0.1:{bhub.port}{bhub.base_url}".rstrip("/")
    return bhub
Launch the BinderHub app

    Currently reads minikube test config from the repo.
    TODO: support input of test config files.

    Detects whether kubernetes is available, and if not disables build.
    Detects whether jupyterhub is available, and if not disables launch.

    app.url will contain the base URL of binderhub.
    
binderhub/tests/conftest.py