Put pluto test in one common file (#1934)

This commit is contained in:
Ayaz Salikhov
2023-07-05 22:07:43 +04:00
committed by GitHub
parent 39582f7099
commit 2edc0fe214
3 changed files with 21 additions and 26 deletions

View 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)

View File

@@ -1,32 +1,13 @@
import logging # Copyright (c) Jupyter Development Team.
import secrets # Distributed under the terms of the Modified BSD License.
import time
import requests import requests
from tests.conftest import TrackedContainer, find_free_port from tests.conftest import TrackedContainer
from tests.pluto_check import check_pluto_proxy
LOGGER = logging.getLogger(__name__)
def test_pluto_proxy( def test_pluto_proxy(
container: TrackedContainer, http_client: requests.Session container: TrackedContainer, http_client: requests.Session
) -> None: ) -> None:
"""Pluto proxy starts Pluto correctly""" """Pluto proxy starts Pluto correctly"""
host_port = find_free_port() check_pluto_proxy(container, http_client)
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"

View File

@@ -1,3 +1,5 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import logging import logging
import secrets import secrets
import time import time
@@ -9,10 +11,9 @@ from tests.conftest import TrackedContainer, find_free_port
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
def test_pluto_proxy( def check_pluto_proxy(
container: TrackedContainer, http_client: requests.Session container: TrackedContainer, http_client: requests.Session
) -> None: ) -> None:
"""Pluto proxy starts Pluto correctly"""
host_port = find_free_port() host_port = find_free_port()
token = secrets.token_hex() token = secrets.token_hex()
container.run_detached( container.run_detached(