def never_spawn(app):
    """Fixture enabling NeverSpawner"""
    with mock.patch.dict(app.tornado_settings, {'spawner_class': mocking.NeverSpawner}):
        yield
Fixture enabling NeverSpawner
jupyterhub/tests/conftest.py