Skip to content

Commit 2edc0fe

Browse files
authored
Put pluto test in one common file (#1934)
1 parent 39582f7 commit 2edc0fe

File tree

3 files changed

+21
-26
lines changed

3 files changed

+21
-26
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) Jupyter Development Team.
2+
# Distributed under the terms of the Modified BSD License.
3+
import requests
4+
5+
from tests.conftest import TrackedContainer
6+
from tests.pluto_check import check_pluto_proxy
7+
8+
9+
def test_pluto_proxy(
10+
container: TrackedContainer, http_client: requests.Session
11+
) -> None:
12+
"""Pluto proxy starts Pluto correctly"""
13+
check_pluto_proxy(container, http_client)

tests/julia-notebook/test_pluto.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
1-
import logging
2-
import secrets
3-
import time
4-
1+
# Copyright (c) Jupyter Development Team.
2+
# Distributed under the terms of the Modified BSD License.
53
import requests
64

7-
from tests.conftest import TrackedContainer, find_free_port
8-
9-
LOGGER = logging.getLogger(__name__)
5+
from tests.conftest import TrackedContainer
6+
from tests.pluto_check import check_pluto_proxy
107

118

129
def test_pluto_proxy(
1310
container: TrackedContainer, http_client: requests.Session
1411
) -> None:
1512
"""Pluto proxy starts Pluto correctly"""
16-
host_port = find_free_port()
17-
token = secrets.token_hex()
18-
container.run_detached(
19-
command=[
20-
"start.sh",
21-
"jupyter",
22-
"lab",
23-
"--port=8888",
24-
f"--LabApp.token={token}",
25-
],
26-
ports={"8888/tcp": host_port},
27-
)
28-
# Give the server a bit of time to start
29-
time.sleep(3)
30-
resp = http_client.get(f"http://localhost:{host_port}/pluto?token={token}")
31-
resp.raise_for_status()
32-
assert "Pluto.jl notebooks" in resp.text, "Pluto.jl text not found in /pluto page"
13+
check_pluto_proxy(container, http_client)

tests/datascience-notebook/test_julia_starts.py renamed to tests/pluto_check.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Jupyter Development Team.
2+
# Distributed under the terms of the Modified BSD License.
13
import logging
24
import secrets
35
import time
@@ -9,10 +11,9 @@
911
LOGGER = logging.getLogger(__name__)
1012

1113

12-
def test_pluto_proxy(
14+
def check_pluto_proxy(
1315
container: TrackedContainer, http_client: requests.Session
1416
) -> None:
15-
"""Pluto proxy starts Pluto correctly"""
1617
host_port = find_free_port()
1718
token = secrets.token_hex()
1819
container.run_detached(

0 commit comments

Comments
 (0)