Skip to content

Commit c89d5ac

Browse files
Use formatted strings
Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
1 parent 5ebb4bd commit c89d5ac

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

base-notebook/test/test_container_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_cli_args(container: TrackedContainer, http_client: requests.Session) ->
2020
ports={"8888/tcp": None},
2121
)
2222
host_port = container.get_host_port("8888/tcp")
23-
resp = http_client.get("http://localhost:" + host_port)
23+
resp = http_client.get(f"http://localhost:{host_port}")
2424
resp.raise_for_status()
2525
logs = running_container.logs().decode("utf-8")
2626
LOGGER.debug(logs)
@@ -47,7 +47,7 @@ def test_unsigned_ssl(
4747
# abort the retry logic. Forcing a long sleep for the moment until I have
4848
# time to dig more.
4949
time.sleep(5)
50-
resp = http_client.get("https://localhost:" + host_port, verify=False)
50+
resp = http_client.get(f"https://localhost:{host_port}", verify=False)
5151
resp.raise_for_status()
5252
assert "login_submit" in resp.text
5353
logs = running_container.logs().decode("utf-8")

base-notebook/test/test_start_container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_start_notebook(
7070
# checking if the server is listening
7171
if expected_start:
7272
host_port = container.get_host_port("8888/tcp")
73-
resp = http_client.get("http://localhost:" + host_port)
73+
resp = http_client.get(f"http://localhost:{host_port}")
7474
assert resp.status_code == 200, "Server is not listening"
7575

7676

conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def run_and_wait(
109109
return logs
110110

111111
def get_host_port(self, container_port: str) -> str:
112+
"""Returns the host port associated with the tracked container's port."""
112113
assert isinstance(self.container, Container)
113114
self.container.reload()
114115
return self.container.attrs["NetworkSettings"]["Ports"][container_port][0][

test/test_notebook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ def test_secured_server(
1212
"""Notebook server should eventually request user login."""
1313
container.run_detached(ports={"8888/tcp": None})
1414
host_port = container.get_host_port("8888/tcp")
15-
resp = http_client.get("http://localhost:" + host_port)
15+
resp = http_client.get(f"http://localhost:{host_port}")
1616
resp.raise_for_status()
1717
assert "login_submit" in resp.text, "User login not requested"

0 commit comments

Comments
 (0)