Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions images/base-notebook/start-notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# If we are in a JupyterHub, we pass on to `start-singleuser.py` instead so it does the right thing
if "JUPYTERHUB_API_TOKEN" in os.environ:
print(
"WARNING: using start-singleuser.py instead of start-notebook.py to start a server associated with JupyterHub."
"WARNING: using start-singleuser.py instead of start-notebook.py to start a server associated with JupyterHub.",
flush=True,
)
command = ["/usr/local/bin/start-singleuser.py"] + sys.argv[1:]
os.execvp(command[0], command)
Expand Down Expand Up @@ -40,5 +41,5 @@
command += sys.argv[1:]

# Execute the command!
print("Executing: " + " ".join(command))
print("Executing: " + " ".join(command), flush=True)
Copy link
Member Author

@mathbunnyru mathbunnyru Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what was going on without TTY is that the output was buffered and this buffer was lost and not flushed, so the test was failing.

Adding flush allows us to write a test without a tty (the lost output is required in the test)

os.execvp(command[0], command)
2 changes: 1 addition & 1 deletion images/base-notebook/start-singleuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
command += sys.argv[1:]

# Execute the command!
print("Executing: " + " ".join(command))
print("Executing: " + " ".join(command), flush=True)
os.execvp(command[0], command)
6 changes: 1 addition & 5 deletions tests/by_image/base-notebook/test_start_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ def test_start_notebook(
f"Test that the start-notebook.py launches the {expected_command} server from the env {env} ..."
)
host_port = find_free_port()
container.run_detached(
tty=True,
environment=env,
ports={"8888/tcp": host_port},
)
container.run_detached(environment=env, ports={"8888/tcp": host_port})
# sleeping some time to let the server start
time.sleep(2)
logs = container.get_logs()
Expand Down