mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-12 04:22:58 +00:00
Put pluto test in one common file (#1934)
This commit is contained in:
13
tests/datascience-notebook/test_pluto_datascience.py
Normal file
13
tests/datascience-notebook/test_pluto_datascience.py
Normal file
@@ -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)
|
@@ -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)
|
||||
|
@@ -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 @@ from tests.conftest import TrackedContainer, find_free_port
|
||||
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(
|
Reference in New Issue
Block a user