mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-09 11:02:57 +00:00
Refactor TrackedContainer run_detached/exec_cmd functions (#2256)
* Refactor TrackedContainer run_detached/exec_cmd functions * Add get_logs() method * Small fixes * Make get_health() a method * Remove kwargs, always print output * Small fixes
This commit is contained in:
@@ -38,18 +38,16 @@ def test_matplotlib(
|
||||
cont_data_dir = "/home/jovyan/data"
|
||||
output_dir = "/tmp"
|
||||
LOGGER.info(description)
|
||||
running_container = container.run_detached(
|
||||
container.run_detached(
|
||||
volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}},
|
||||
tty=True,
|
||||
command=["bash", "-c", "sleep infinity"],
|
||||
)
|
||||
|
||||
command = f"python {cont_data_dir}/{test_file}"
|
||||
exec_result = running_container.exec_run(command)
|
||||
LOGGER.debug(exec_result.output.decode())
|
||||
assert exec_result.exit_code == 0, f"Command {command} failed"
|
||||
container.exec_cmd(command)
|
||||
|
||||
# Checking if the file is generated
|
||||
# https://stackoverflow.com/a/15895594/4413446
|
||||
command = f"test -s {output_dir}/{expected_file}"
|
||||
exec_result = running_container.exec_run(command)
|
||||
LOGGER.debug(exec_result.output.decode())
|
||||
assert exec_result.exit_code == 0, f"Command {command} failed"
|
||||
container.exec_cmd(command)
|
||||
|
Reference in New Issue
Block a user