JupyterHub Spawners Plugin#

Module: pytest_jupyterhub.jupyterhub_spawners#

This plugin module will create a lightweight jupyterhub application that can be used to test different spawner implementations

pytest_jupyterhub.jupyterhub_spawners.configured_mockhub_instance()#

Creates a MockHub instance from a provided config dict or with the empty config if none is passed as an argument.

This fixture is a factory and returns a function. More about factory fixtures at https://docs.pytest.org/en/latest/how-to/fixtures.html#factories-as-fixtures

It should be called like:

def my_test(configured_mockhub_instance):
    hub_instance = configured_mockhub_instance(config={"a": "b"})
    ...

Note that the fixture has a function scope.

pytest_jupyterhub.jupyterhub_spawners.hub_app(configured_mockhub_instance)#

Creates a MockHub instance from a provided config dict, it then starts and yields it.

This fixture is a factory and returns an async function. More about factory fixtures at https://docs.pytest.org/en/latest/how-to/fixtures.html#factories-as-fixtures

It should be called like:

async def my_test(hub_app):
    app = await hub_app(config={"a": "b"})
    ...

The created app is stopped and the instance is cleaned up afterwards.

Note that the fixture has a function scope.