diff --git a/tests/by_image/all-spark-notebook/test_spark_notebooks.py b/tests/by_image/all-spark-notebook/test_spark_notebooks.py index c998a1b6..8ab7b7d5 100644 --- a/tests/by_image/all-spark-notebook/test_spark_notebooks.py +++ b/tests/by_image/all-spark-notebook/test_spark_notebooks.py @@ -33,7 +33,6 @@ def test_nbconvert(container: TrackedContainer, test_file: str) -> None: timeout=60, no_warnings=False, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, - tty=True, command=["bash", "-c", command], ) warnings = TrackedContainer.get_warnings(logs) diff --git a/tests/by_image/base-notebook/test_container_options.py b/tests/by_image/base-notebook/test_container_options.py index f4a68cd7..9d988fc8 100644 --- a/tests/by_image/base-notebook/test_container_options.py +++ b/tests/by_image/base-notebook/test_container_options.py @@ -33,7 +33,6 @@ def test_nb_user_change(container: TrackedContainer) -> None: """Container should change the username (`NB_USER`) of the default user.""" nb_user = "nayvoj" container.run_detached( - tty=True, user="root", environment=[f"NB_USER={nb_user}", "CHOWN_HOME=yes"], command=["bash", "-c", "sleep infinity"], diff --git a/tests/by_image/base-notebook/test_healthcheck.py b/tests/by_image/base-notebook/test_healthcheck.py index 5ddb8959..937bcfe9 100644 --- a/tests/by_image/base-notebook/test_healthcheck.py +++ b/tests/by_image/base-notebook/test_healthcheck.py @@ -17,7 +17,6 @@ def get_healthy_status( user: str | None, ) -> str: container.run_detached( - tty=True, environment=env, command=cmd, user=user, diff --git a/tests/by_image/base-notebook/test_ips.py b/tests/by_image/base-notebook/test_ips.py index 0465c52b..66b51e2f 100644 --- a/tests/by_image/base-notebook/test_ips.py +++ b/tests/by_image/base-notebook/test_ips.py @@ -41,6 +41,5 @@ def test_ipv46(container: TrackedContainer, ipv6_network: str) -> None: container.run_detached( network=ipv6_network, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro,z"}}, - tty=True, ) container.exec_cmd(f"python {cont_data_dir}/check_listening.py") diff --git a/tests/by_image/base-notebook/test_pandoc.py b/tests/by_image/base-notebook/test_pandoc.py index 3420e4f2..9a47caef 100644 --- a/tests/by_image/base-notebook/test_pandoc.py +++ b/tests/by_image/base-notebook/test_pandoc.py @@ -11,7 +11,6 @@ def test_pandoc(container: TrackedContainer) -> None: """Pandoc shall be able to convert MD to HTML.""" logs = container.run_and_wait( timeout=10, - tty=True, command=["bash", "-c", 'echo "**BOLD**" | pandoc'], ) assert "
BOLD
" in logs diff --git a/tests/by_image/base-notebook/test_start_container.py b/tests/by_image/base-notebook/test_start_container.py index 2603ae41..7e7af043 100644 --- a/tests/by_image/base-notebook/test_start_container.py +++ b/tests/by_image/base-notebook/test_start_container.py @@ -76,7 +76,7 @@ def test_tini_entrypoint( https://superuser.com/questions/632979/if-i-know-the-pid-number-of-a-process-how-can-i-get-its-name """ LOGGER.info(f"Test that {command} is launched as PID {pid} ...") - container.run_detached(tty=True) + container.run_detached() # Select the PID 1 and get the corresponding command output = container.exec_cmd(f"ps -p {pid} -o comm=") assert "ERROR" not in output diff --git a/tests/by_image/docker-stacks-foundation/test_python_version.py b/tests/by_image/docker-stacks-foundation/test_python_version.py index 65ea6010..b4230333 100644 --- a/tests/by_image/docker-stacks-foundation/test_python_version.py +++ b/tests/by_image/docker-stacks-foundation/test_python_version.py @@ -14,7 +14,6 @@ def test_python_version(container: TrackedContainer) -> None: ) logs = container.run_and_wait( timeout=5, - tty=True, command=["python", "--version"], ) python = next(line for line in logs.splitlines() if line.startswith("Python ")) @@ -28,7 +27,6 @@ def test_python_pinned_version(container: TrackedContainer) -> None: LOGGER.info(f"Checking that pinned python version is {EXPECTED_PYTHON_VERSION}.*") logs = container.run_and_wait( timeout=5, - tty=True, command=["cat", "/opt/conda/conda-meta/pinned"], ) assert f"python {EXPECTED_PYTHON_VERSION}.*" in logs diff --git a/tests/by_image/docker-stacks-foundation/test_run_hooks.py b/tests/by_image/docker-stacks-foundation/test_run_hooks.py index 82f1ca5a..1c7d8551 100644 --- a/tests/by_image/docker-stacks-foundation/test_run_hooks.py +++ b/tests/by_image/docker-stacks-foundation/test_run_hooks.py @@ -12,7 +12,6 @@ THIS_DIR = Path(__file__).parent.resolve() def test_run_hooks_zero_args(container: TrackedContainer) -> None: logs = container.run_and_wait( timeout=5, - tty=True, no_failure=False, command=["bash", "-c", "source /usr/local/bin/run-hooks.sh"], ) @@ -22,7 +21,6 @@ def test_run_hooks_zero_args(container: TrackedContainer) -> None: def test_run_hooks_two_args(container: TrackedContainer) -> None: logs = container.run_and_wait( timeout=5, - tty=True, no_failure=False, command=[ "bash", @@ -36,7 +34,6 @@ def test_run_hooks_two_args(container: TrackedContainer) -> None: def test_run_hooks_missing_dir(container: TrackedContainer) -> None: logs = container.run_and_wait( timeout=5, - tty=True, no_failure=False, command=[ "bash", @@ -50,7 +47,6 @@ def test_run_hooks_missing_dir(container: TrackedContainer) -> None: def test_run_hooks_dir_is_file(container: TrackedContainer) -> None: logs = container.run_and_wait( timeout=5, - tty=True, no_failure=False, command=[ "bash", @@ -64,7 +60,6 @@ def test_run_hooks_dir_is_file(container: TrackedContainer) -> None: def test_run_hooks_empty_dir(container: TrackedContainer) -> None: container.run_and_wait( timeout=5, - tty=True, command=[ "bash", "-c", @@ -91,7 +86,6 @@ def run_source_in_dir( return container.run_and_wait( timeout=5, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, - tty=True, no_failure=no_failure, command=["bash", "-c", command], ) diff --git a/tests/by_image/docker-stacks-foundation/test_units.py b/tests/by_image/docker-stacks-foundation/test_units.py index 138d985a..0f89b57c 100644 --- a/tests/by_image/docker-stacks-foundation/test_units.py +++ b/tests/by_image/docker-stacks-foundation/test_units.py @@ -33,6 +33,5 @@ def test_units(container: TrackedContainer) -> None: container.run_and_wait( timeout=30, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, - tty=True, command=["python", f"{cont_data_dir}/{test_file_name}"], ) diff --git a/tests/by_image/docker-stacks-foundation/test_user_options.py b/tests/by_image/docker-stacks-foundation/test_user_options.py index 87b2468b..dedb36f7 100644 --- a/tests/by_image/docker-stacks-foundation/test_user_options.py +++ b/tests/by_image/docker-stacks-foundation/test_user_options.py @@ -15,7 +15,6 @@ def test_uid_change(container: TrackedContainer) -> None: """Container should change the UID of the default user.""" logs = container.run_and_wait( timeout=120, # usermod is slow so give it some time - tty=True, user="root", environment=["NB_UID=1010"], command=["bash", "-c", "id && touch /opt/conda/test-file"], @@ -27,7 +26,6 @@ def test_gid_change(container: TrackedContainer) -> None: """Container should change the GID of the default user.""" logs = container.run_and_wait( timeout=10, - tty=True, user="root", environment=["NB_GID=110"], command=["id"], @@ -40,7 +38,6 @@ def test_nb_user_change(container: TrackedContainer) -> None: """Container should change the username (`NB_USER`) of the default user.""" nb_user = "nayvoj" container.run_detached( - tty=True, user="root", environment=[f"NB_USER={nb_user}", "CHOWN_HOME=yes"], command=["bash", "-c", "sleep infinity"], @@ -87,7 +84,6 @@ def test_chown_extra(container: TrackedContainer) -> None: CHOWN_EXTRA list of folders.""" logs = container.run_and_wait( timeout=120, # chown is slow so give it some time - tty=True, user="root", environment=[ "NB_UID=1010", @@ -110,7 +106,6 @@ def test_chown_home(container: TrackedContainer) -> None: group to the current value of NB_UID and NB_GID.""" logs = container.run_and_wait( timeout=120, # chown is slow so give it some time - tty=True, user="root", environment=[ "CHOWN_HOME=yes", @@ -128,7 +123,6 @@ def test_sudo(container: TrackedContainer) -> None: """Container should grant passwordless sudo to the default user.""" logs = container.run_and_wait( timeout=10, - tty=True, user="root", environment=["GRANT_SUDO=yes"], command=["sudo", "id"], @@ -140,7 +134,6 @@ def test_sudo_path(container: TrackedContainer) -> None: """Container should include /opt/conda/bin in the sudo secure_path.""" logs = container.run_and_wait( timeout=10, - tty=True, user="root", environment=["GRANT_SUDO=yes"], command=["sudo", "which", "jupyter"], @@ -152,7 +145,6 @@ def test_sudo_path_without_grant(container: TrackedContainer) -> None: """Container should include /opt/conda/bin in the sudo secure_path.""" logs = container.run_and_wait( timeout=10, - tty=True, user="root", command=["which", "jupyter"], ) @@ -224,7 +216,6 @@ def test_container_not_delete_bind_mount( container.run_and_wait( timeout=5, - tty=True, user="root", working_dir="/home/", environment=[ @@ -247,7 +238,6 @@ def test_jupyter_env_vars_to_unset( root_args = {"user": "root"} if enable_root else {} logs = container.run_and_wait( timeout=10, - tty=True, environment=[ "JUPYTER_ENV_VARS_TO_UNSET=SECRET_ANIMAL,UNUSED_ENV,SECRET_FRUIT", "FRUIT=bananas", @@ -276,7 +266,6 @@ def test_secure_path(container: TrackedContainer, tmp_path: pathlib.Path) -> Non logs = container.run_and_wait( timeout=5, - tty=True, user="root", volumes={p: {"bind": "/usr/bin/python", "mode": "ro"}}, command=["python", "--version"], @@ -290,7 +279,6 @@ def test_startsh_multiple_exec(container: TrackedContainer) -> None: logs = container.run_and_wait( timeout=10, no_warnings=False, - tty=True, user="root", environment=["GRANT_SUDO=yes"], command=["start.sh", "sudo", "id"], @@ -308,7 +296,6 @@ def test_rootless_triplet_change(container: TrackedContainer) -> None: """Container should change the username (`NB_USER`), the UID and the GID of the default user.""" logs = container.run_and_wait( timeout=10, - tty=True, user="root", environment=["NB_USER=root", "NB_UID=0", "NB_GID=0"], command=["id"], @@ -322,7 +309,6 @@ def test_rootless_triplet_home(container: TrackedContainer) -> None: """Container should change the home directory for triplet NB_USER=root, NB_UID=0, NB_GID=0.""" logs = container.run_and_wait( timeout=10, - tty=True, user="root", environment=["NB_USER=root", "NB_UID=0", "NB_GID=0"], command=["bash", "-c", "echo HOME=${HOME} && getent passwd root"], @@ -335,7 +321,6 @@ def test_rootless_triplet_sudo(container: TrackedContainer) -> None: """Container should not be started with sudo for triplet NB_USER=root, NB_UID=0, NB_GID=0.""" logs = container.run_and_wait( timeout=10, - tty=True, user="root", environment=["NB_USER=root", "NB_UID=0", "NB_GID=0"], command=["env"], diff --git a/tests/by_image/minimal-notebook/test_nbconvert.py b/tests/by_image/minimal-notebook/test_nbconvert.py index 54c1cecd..d043a8ed 100644 --- a/tests/by_image/minimal-notebook/test_nbconvert.py +++ b/tests/by_image/minimal-notebook/test_nbconvert.py @@ -27,7 +27,6 @@ def test_nbconvert( logs = container.run_and_wait( timeout=30, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, - tty=True, command=["bash", "-c", command], ) expected_file = f"{output_dir}/{test_file}.{output_format}" diff --git a/tests/by_image/pyspark-notebook/test_spark.py b/tests/by_image/pyspark-notebook/test_spark.py index 8ac720d1..7a9d7dfd 100644 --- a/tests/by_image/pyspark-notebook/test_spark.py +++ b/tests/by_image/pyspark-notebook/test_spark.py @@ -12,7 +12,6 @@ def test_spark_shell(container: TrackedContainer) -> None: logs = container.run_and_wait( timeout=60, no_warnings=False, - tty=True, command=["bash", "-c", 'spark-shell <<< "1+1"'], ) warnings = TrackedContainer.get_warnings(logs) diff --git a/tests/by_image/scipy-notebook/test_cython.py b/tests/by_image/scipy-notebook/test_cython.py index 1f1f8769..6e5d6577 100644 --- a/tests/by_image/scipy-notebook/test_cython.py +++ b/tests/by_image/scipy-notebook/test_cython.py @@ -14,7 +14,6 @@ def test_cython(container: TrackedContainer) -> None: logs = container.run_and_wait( timeout=10, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, - tty=True, command=[ "bash", "-c", diff --git a/tests/by_image/scipy-notebook/test_extensions.py b/tests/by_image/scipy-notebook/test_extensions.py index d64b1b20..c633d539 100644 --- a/tests/by_image/scipy-notebook/test_extensions.py +++ b/tests/by_image/scipy-notebook/test_extensions.py @@ -29,6 +29,5 @@ def test_check_extension(container: TrackedContainer, extension: str) -> None: LOGGER.info(f"Checking the extension: {extension} ...") container.run_and_wait( timeout=10, - tty=True, command=["jupyter", "labextension", "check", extension], ) diff --git a/tests/by_image/scipy-notebook/test_matplotlib.py b/tests/by_image/scipy-notebook/test_matplotlib.py index fc699356..d02a4e1f 100644 --- a/tests/by_image/scipy-notebook/test_matplotlib.py +++ b/tests/by_image/scipy-notebook/test_matplotlib.py @@ -40,7 +40,6 @@ def test_matplotlib( LOGGER.info(description) container.run_detached( volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, - tty=True, command=["bash", "-c", "sleep infinity"], ) diff --git a/tests/shared_checks/R_mimetype_check.py b/tests/shared_checks/R_mimetype_check.py index 52ae4e94..2e8a3f82 100644 --- a/tests/shared_checks/R_mimetype_check.py +++ b/tests/shared_checks/R_mimetype_check.py @@ -12,11 +12,7 @@ def check_r_mimetypes(container: TrackedContainer) -> None: LOGGER.info("Test that R command can be executed ...") R_MIMETYPES_CHECK_CMD = 'if (length(getOption("jupyter.plot_mimetypes")) != 5) {stop("missing jupyter.plot_mimetypes")}' command = ["Rscript", "-e", R_MIMETYPES_CHECK_CMD] - logs = container.run_and_wait( - timeout=10, - tty=True, - command=command, - ) + logs = container.run_and_wait(timeout=10, command=command) LOGGER.debug(f"{logs=}") # If there is any output after this it means there was an error assert logs.splitlines()[-1] == "Executing the command: " + " ".join( diff --git a/tests/utils/conda_package_helper.py b/tests/utils/conda_package_helper.py index a7592855..92a72397 100644 --- a/tests/utils/conda_package_helper.py +++ b/tests/utils/conda_package_helper.py @@ -43,10 +43,7 @@ class CondaPackageHelper: self.container = container LOGGER.info(f"Starting container {self.container.image_name} ...") - self.container.run_detached( - tty=True, - command=["bash", "-c", "sleep infinity"], - ) + self.container.run_detached(command=["bash", "-c", "sleep infinity"]) self.requested: dict[str, set[str]] | None = None self.installed: dict[str, set[str]] | None = None diff --git a/tests/utils/run_command.py b/tests/utils/run_command.py index fbcca1c8..b47eab4e 100644 --- a/tests/utils/run_command.py +++ b/tests/utils/run_command.py @@ -12,11 +12,8 @@ def run_command( command: str, timeout: int = 5, ) -> str: - """Runs the given package manager with its version argument.""" - LOGGER.info(f"Test that the command '{command}' is working properly ...") return container.run_and_wait( timeout=timeout, - tty=True, command=["bash", "-c", command], )