mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-10 19:42:58 +00:00
Move assert after logs output to make debug easier
This commit is contained in:
@@ -32,8 +32,8 @@ def test_nbconvert(container, test_file):
|
|||||||
command=["start.sh", "bash", "-c", command],
|
command=["start.sh", "bash", "-c", command],
|
||||||
)
|
)
|
||||||
rv = c.wait(timeout=timeout_ms / 10 + 10)
|
rv = c.wait(timeout=timeout_ms / 10 + 10)
|
||||||
assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"
|
|
||||||
logs = c.logs(stdout=True).decode("utf-8")
|
logs = c.logs(stdout=True).decode("utf-8")
|
||||||
LOGGER.debug(logs)
|
LOGGER.debug(logs)
|
||||||
|
assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"
|
||||||
expected_file = f"{output_dir}/{test_file}.md"
|
expected_file = f"{output_dir}/{test_file}.md"
|
||||||
assert expected_file in logs, f"Expected file {expected_file} not generated"
|
assert expected_file in logs, f"Expected file {expected_file} not generated"
|
||||||
|
@@ -28,7 +28,7 @@ def test_package_manager(container, package_manager, version_arg):
|
|||||||
)
|
)
|
||||||
rv = c.wait(timeout=5)
|
rv = c.wait(timeout=5)
|
||||||
logs = c.logs(stdout=True).decode("utf-8")
|
logs = c.logs(stdout=True).decode("utf-8")
|
||||||
|
LOGGER.debug(logs)
|
||||||
assert (
|
assert (
|
||||||
rv == 0 or rv["StatusCode"] == 0
|
rv == 0 or rv["StatusCode"] == 0
|
||||||
), f"Package manager {package_manager} not working"
|
), f"Package manager {package_manager} not working"
|
||||||
LOGGER.debug(logs)
|
|
||||||
|
@@ -21,9 +21,9 @@ def test_start_notebook(container, http_client, env, expected_server):
|
|||||||
)
|
)
|
||||||
c = container.run(tty=True, environment=env, command=["start-notebook.sh"])
|
c = container.run(tty=True, environment=env, command=["start-notebook.sh"])
|
||||||
resp = http_client.get("http://localhost:8888")
|
resp = http_client.get("http://localhost:8888")
|
||||||
assert resp.status_code == 200, "Server is not listening"
|
|
||||||
logs = c.logs(stdout=True).decode("utf-8")
|
logs = c.logs(stdout=True).decode("utf-8")
|
||||||
LOGGER.debug(logs)
|
LOGGER.debug(logs)
|
||||||
|
assert resp.status_code == 200, "Server is not listening"
|
||||||
assert (
|
assert (
|
||||||
f"Executing the command: jupyter {expected_server}" in logs
|
f"Executing the command: jupyter {expected_server}" in logs
|
||||||
), f"Not the expected command (jupyter {expected_server}) was launched"
|
), f"Not the expected command (jupyter {expected_server}) was launched"
|
||||||
|
@@ -15,5 +15,5 @@ def test_julia(container):
|
|||||||
command = "julia --version"
|
command = "julia --version"
|
||||||
cmd = running_container.exec_run(command)
|
cmd = running_container.exec_run(command)
|
||||||
output = cmd.output.decode("utf-8")
|
output = cmd.output.decode("utf-8")
|
||||||
assert cmd.exit_code == 0, f"Command {command} failed {output}"
|
|
||||||
LOGGER.debug(output)
|
LOGGER.debug(output)
|
||||||
|
assert cmd.exit_code == 0, f"Command {command} failed {output}"
|
||||||
|
@@ -32,8 +32,8 @@ def test_nbconvert(container, test_file, output_format):
|
|||||||
command=["start.sh", "bash", "-c", command],
|
command=["start.sh", "bash", "-c", command],
|
||||||
)
|
)
|
||||||
rv = c.wait(timeout=30)
|
rv = c.wait(timeout=30)
|
||||||
assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"
|
|
||||||
logs = c.logs(stdout=True).decode("utf-8")
|
logs = c.logs(stdout=True).decode("utf-8")
|
||||||
LOGGER.debug(logs)
|
LOGGER.debug(logs)
|
||||||
|
assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"
|
||||||
expected_file = f"{output_dir}/{test_file}.{output_format}"
|
expected_file = f"{output_dir}/{test_file}.{output_format}"
|
||||||
assert expected_file in logs, f"Expected file {expected_file} not generated"
|
assert expected_file in logs, f"Expected file {expected_file} not generated"
|
||||||
|
@@ -25,6 +25,6 @@ def test_pyspark(container):
|
|||||||
command=['start.sh', 'python', '-c', 'import pyspark']
|
command=['start.sh', 'python', '-c', 'import pyspark']
|
||||||
)
|
)
|
||||||
rv = c.wait(timeout=30)
|
rv = c.wait(timeout=30)
|
||||||
assert rv == 0 or rv["StatusCode"] == 0, "pyspark not in PYTHONPATH"
|
|
||||||
logs = c.logs(stdout=True).decode('utf-8')
|
logs = c.logs(stdout=True).decode('utf-8')
|
||||||
LOGGER.debug(logs)
|
LOGGER.debug(logs)
|
||||||
|
assert rv == 0 or rv["StatusCode"] == 0, "pyspark not in PYTHONPATH"
|
||||||
|
@@ -35,11 +35,11 @@ def test_matplotlib(container, test_file, expected_file, description):
|
|||||||
)
|
)
|
||||||
command = f"python {cont_data_dir}/{test_file}"
|
command = f"python {cont_data_dir}/{test_file}"
|
||||||
cmd = running_container.exec_run(command)
|
cmd = running_container.exec_run(command)
|
||||||
assert cmd.exit_code == 0, f"Command {command} failed"
|
|
||||||
LOGGER.debug(cmd.output.decode("utf-8"))
|
LOGGER.debug(cmd.output.decode("utf-8"))
|
||||||
|
assert cmd.exit_code == 0, f"Command {command} failed"
|
||||||
# Checking if the file is generated
|
# Checking if the file is generated
|
||||||
# https://stackoverflow.com/a/15895594/4413446
|
# https://stackoverflow.com/a/15895594/4413446
|
||||||
command = f"test -s {output_dir}/{expected_file}"
|
command = f"test -s {output_dir}/{expected_file}"
|
||||||
cmd = running_container.exec_run(command)
|
cmd = running_container.exec_run(command)
|
||||||
assert cmd.exit_code == 0, f"Command {command} failed"
|
|
||||||
LOGGER.debug(cmd.output.decode("utf-8"))
|
LOGGER.debug(cmd.output.decode("utf-8"))
|
||||||
|
assert cmd.exit_code == 0, f"Command {command} failed"
|
||||||
|
@@ -27,6 +27,6 @@ def test_pandas(container, name, command_list):
|
|||||||
command = ';'.join(command_list)
|
command = ';'.join(command_list)
|
||||||
c = container.run(tty=True, command=["start.sh", "python", "-c", command])
|
c = container.run(tty=True, command=["start.sh", "python", "-c", command])
|
||||||
rv = c.wait(timeout=30)
|
rv = c.wait(timeout=30)
|
||||||
assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"
|
|
||||||
logs = c.logs(stdout=True).decode("utf-8")
|
logs = c.logs(stdout=True).decode("utf-8")
|
||||||
LOGGER.debug(logs)
|
LOGGER.debug(logs)
|
||||||
|
assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"
|
||||||
|
@@ -32,8 +32,8 @@ class DockerRunner:
|
|||||||
def run_simple_command(container, cmd: str, print_result: bool = True):
|
def run_simple_command(container, cmd: str, print_result: bool = True):
|
||||||
logger.info(f"Running cmd: '{cmd}' on container: {container}")
|
logger.info(f"Running cmd: '{cmd}' on container: {container}")
|
||||||
out = container.exec_run(cmd)
|
out = container.exec_run(cmd)
|
||||||
assert out.exit_code == 0, f"Command: {cmd} failed"
|
|
||||||
result = out.output.decode("utf-8").rstrip()
|
result = out.output.decode("utf-8").rstrip()
|
||||||
if print_result:
|
if print_result:
|
||||||
logger.info(f"Command result: {result}")
|
logger.info(f"Command result: {result}")
|
||||||
|
assert out.exit_code == 0, f"Command: {cmd} failed"
|
||||||
return result
|
return result
|
||||||
|
@@ -25,6 +25,6 @@ def test_tensorflow(container, name, command):
|
|||||||
LOGGER.info(f"Testing tensorflow: {name} ...")
|
LOGGER.info(f"Testing tensorflow: {name} ...")
|
||||||
c = container.run(tty=True, command=["start.sh", "python", "-c", command])
|
c = container.run(tty=True, command=["start.sh", "python", "-c", command])
|
||||||
rv = c.wait(timeout=30)
|
rv = c.wait(timeout=30)
|
||||||
assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"
|
|
||||||
logs = c.logs(stdout=True).decode("utf-8")
|
logs = c.logs(stdout=True).decode("utf-8")
|
||||||
LOGGER.debug(logs)
|
LOGGER.debug(logs)
|
||||||
|
assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"
|
||||||
|
Reference in New Issue
Block a user