def cleanup_binder_pods(request):
    """Cleanup running user sessions at the beginning and end of a session."""
    if not K8S_AVAILABLE:
        return

    def cleanup():
        return cleanup_pods({"component": "singleuser-server"})

    cleanup()
    request.addfinalizer(cleanup)
Cleanup running user sessions at the beginning and end of a session.
binderhub/tests/conftest.py