Skip to content

Commit

Permalink
Put pluto test in one common file (#1934)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbunnyru authored Jul 5, 2023
1 parent 39582f7 commit 2edc0fe
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
13 changes: 13 additions & 0 deletions tests/datascience-notebook/test_pluto_datascience.py
Original file line number Diff line number Diff line change
@@ -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)
29 changes: 5 additions & 24 deletions tests/julia-notebook/test_pluto.py
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import logging
import secrets
import time
Expand All @@ -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(
Expand Down

0 comments on commit 2edc0fe

Please sign in to comment.