diff --git a/tests/datascience-notebook/test_pluto_datascience.py b/tests/datascience-notebook/test_pluto_datascience.py new file mode 100644 index 0000000000..27c4aaf0d3 --- /dev/null +++ b/tests/datascience-notebook/test_pluto_datascience.py @@ -0,0 +1,13 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. +import requests + +from tests.conftest import TrackedContainer +from tests.pluto_check import check_pluto_proxy + + +def test_pluto_proxy( + container: TrackedContainer, http_client: requests.Session +) -> None: + """Pluto proxy starts Pluto correctly""" + check_pluto_proxy(container, http_client) diff --git a/tests/julia-notebook/test_pluto.py b/tests/julia-notebook/test_pluto.py index a0d59b398e..27c4aaf0d3 100644 --- a/tests/julia-notebook/test_pluto.py +++ b/tests/julia-notebook/test_pluto.py @@ -1,32 +1,13 @@ -import logging -import secrets -import time - +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. import requests -from tests.conftest import TrackedContainer, find_free_port - -LOGGER = logging.getLogger(__name__) +from tests.conftest import TrackedContainer +from tests.pluto_check import check_pluto_proxy def test_pluto_proxy( container: TrackedContainer, http_client: requests.Session ) -> None: """Pluto proxy starts Pluto correctly""" - host_port = find_free_port() - token = secrets.token_hex() - container.run_detached( - command=[ - "start.sh", - "jupyter", - "lab", - "--port=8888", - f"--LabApp.token={token}", - ], - ports={"8888/tcp": host_port}, - ) - # Give the server a bit of time to start - time.sleep(3) - resp = http_client.get(f"http://localhost:{host_port}/pluto?token={token}") - resp.raise_for_status() - assert "Pluto.jl notebooks" in resp.text, "Pluto.jl text not found in /pluto page" + check_pluto_proxy(container, http_client) diff --git a/tests/datascience-notebook/test_julia_starts.py b/tests/pluto_check.py similarity index 86% rename from tests/datascience-notebook/test_julia_starts.py rename to tests/pluto_check.py index a0d59b398e..8a39509c8c 100644 --- a/tests/datascience-notebook/test_julia_starts.py +++ b/tests/pluto_check.py @@ -1,3 +1,5 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. import logging import secrets import time @@ -9,10 +11,9 @@ LOGGER = logging.getLogger(__name__) -def test_pluto_proxy( +def check_pluto_proxy( container: TrackedContainer, http_client: requests.Session ) -> None: - """Pluto proxy starts Pluto correctly""" host_port = find_free_port() token = secrets.token_hex() container.run_detached(