From ad2764ba778b34618e83bd828ac1d8d59b1cfddb Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 4 Apr 2024 06:10:07 -0500 Subject: [PATCH] Fix passing of kwargs to websocket_connect --- pytest_jupyter/jupyter_server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pytest_jupyter/jupyter_server.py b/pytest_jupyter/jupyter_server.py index 1c84fe4..be9bd26 100644 --- a/pytest_jupyter/jupyter_server.py +++ b/pytest_jupyter/jupyter_server.py @@ -4,6 +4,7 @@ from __future__ import annotations import importlib +import inspect import io import logging import os @@ -328,6 +329,10 @@ def client_fetch(*parts, headers=None, params=None, **kwargs): headers.setdefault(key, value) # Make request. req = tornado.httpclient.HTTPRequest(url, headers=headers, connect_timeout=120) + allowed = list(inspect.signature(tornado.websocket.websocket_connect).parameters) + for name in list(kwargs): + if name not in allowed: + del kwargs[name] return tornado.websocket.websocket_connect(req, **kwargs) return client_fetch