def new_hub(request, tmpdir, persist_db):
    """Fixture to launch a new hub for testing"""

    async def new_hub(**kwargs):
        ssl_enabled = getattr(request.module, "ssl_enabled", False)
        if ssl_enabled:
            kwargs['internal_certs_location'] = str(tmpdir)
        app = MockHub(test_clean_db=False, **kwargs)
        app.config.ConfigurableHTTPProxy.should_start = False
        app.config.ConfigurableHTTPProxy.auth_token = 'unused'
        request.addfinalizer(app.stop)
        await app.initialize([])

        return app

    return new_hub
Fixture to launch a new hub for testing
jupyterhub/tests/test_app.py