Skip to content

Fix fixture name #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pytest_jupyter/jupyter_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def jp_argv():


@pytest.fixture()
def http_port(http_server_port):
def jp_http_port(http_server_port):
"""Returns the port value from the http_server_port fixture."""
yield http_server_port[-1]
http_server_port[0].close()
Expand Down Expand Up @@ -161,7 +161,7 @@ def jp_configurable_serverapp(
jp_environ,
jp_server_config,
jp_argv,
http_port,
jp_http_port,
jp_base_url,
tmp_path,
jp_root_dir,
Expand Down Expand Up @@ -195,7 +195,7 @@ def _configurable_serverapp(
base_url=jp_base_url,
argv=jp_argv,
environ=jp_environ,
http_port=http_port,
http_port=jp_http_port,
tmp_path=tmp_path,
io_loop=io_loop,
root_dir=jp_root_dir,
Expand All @@ -222,7 +222,7 @@ def _configurable_serverapp(
app = ServerApp.instance(
# Set the log level to debug for testing purposes
log_level="DEBUG",
port=http_port,
port=jp_http_port,
port_retries=0,
open_browser=False,
base_url=base_url,
Expand Down Expand Up @@ -315,7 +315,7 @@ def client_fetch(*parts, headers=None, params=None, **kwargs):


@pytest.fixture
def jp_ws_fetch(jp_serverapp, http_server_client, jp_auth_header, http_port, jp_base_url):
def jp_ws_fetch(jp_serverapp, http_server_client, jp_auth_header, jp_http_port, jp_base_url):
"""Sends a websocket request to a test server.
The fixture is a factory; it can be called like
a function inside a unit test. Here's a basic
Expand Down Expand Up @@ -348,7 +348,7 @@ def client_fetch(*parts, headers=None, params=None, **kwargs):
# Handle URL strings
path_url = url_escape(url_path_join(*parts), plus=False)
base_path_url = url_path_join(jp_base_url, path_url)
urlparts = urllib.parse.urlparse(f"ws://localhost:{http_port}")
urlparts = urllib.parse.urlparse(f"ws://localhost:{jp_http_port}")
urlparts = urlparts._replace(path=base_path_url, query=urllib.parse.urlencode(params))
url = urlparts.geturl()
# Add auth keys to header
Expand Down
2 changes: 1 addition & 1 deletion tests/test_jupyter_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def test_send_request(send_request):
assert code == 200


async def test_connection(jp_fetch, jp_ws_fetch, http_port, jp_auth_header):
async def test_connection(jp_fetch, jp_ws_fetch, jp_http_port, jp_auth_header):
# Create kernel
r = await jp_fetch("api", "kernels", method="POST", body="{}")
kid = json.loads(r.body.decode())["id"]
Expand Down