From 411663b5d4ee4632e980cc9b2efdbb410cca919d Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 28 Jun 2021 15:09:13 +0200 Subject: [PATCH] black style tweaks: add trailing commas --- base-notebook/test/test_container_options.py | 17 ++++++++++++++--- base-notebook/test/test_package_managers.py | 3 ++- base-notebook/test/test_pandoc.py | 3 ++- base-notebook/test/test_python.py | 5 ++++- base-notebook/test/test_start_container.py | 11 +++++++++-- datascience-notebook/test/test_julia.py | 3 ++- minimal-notebook/test/test_inkscape.py | 3 ++- pyspark-notebook/test/test_spark.py | 3 ++- scipy-notebook/test/test_extensions.py | 3 ++- test/helpers.py | 3 ++- 10 files changed, 41 insertions(+), 13 deletions(-) diff --git a/base-notebook/test/test_container_options.py b/base-notebook/test/test_container_options.py index 6ca616a3..91cce1a8 100644 --- a/base-notebook/test/test_container_options.py +++ b/base-notebook/test/test_container_options.py @@ -51,7 +51,10 @@ def test_uid_change(container): def test_gid_change(container): """Container should change the GID of the default user.""" c = container.run( - tty=True, user="root", environment=["NB_GID=110"], command=["start.sh", "id"] + tty=True, + user="root", + environment=["NB_GID=110"], + command=["start.sh", "id"], ) c.wait(timeout=10) logs = c.logs(stdout=True).decode("utf-8") @@ -160,7 +163,11 @@ def test_sudo_path(container): def test_sudo_path_without_grant(container): """Container should include /opt/conda/bin in the sudo secure_path.""" - c = container.run(tty=True, user="root", command=["start.sh", "which", "jupyter"]) + c = container.run( + tty=True, + user="root", + command=["start.sh", "which", "jupyter"], + ) rv = c.wait(timeout=10) assert rv == 0 or rv["StatusCode"] == 0 logs = c.logs(stdout=True).decode("utf-8") @@ -171,7 +178,11 @@ def test_group_add(container, tmpdir): """Container should run with the specified uid, gid, and secondary group. """ - c = container.run(user="1010:1010", group_add=["users"], command=["start.sh", "id"]) + c = container.run( + user="1010:1010", + group_add=["users"], + command=["start.sh", "id"], + ) rv = c.wait(timeout=5) assert rv == 0 or rv["StatusCode"] == 0 logs = c.logs(stdout=True).decode("utf-8") diff --git a/base-notebook/test/test_package_managers.py b/base-notebook/test/test_package_managers.py index e673078c..7c96a73d 100644 --- a/base-notebook/test/test_package_managers.py +++ b/base-notebook/test/test_package_managers.py @@ -23,7 +23,8 @@ def test_package_manager(container, package_manager, version_arg): f"Test that the package manager {package_manager} is working properly ..." ) c = container.run( - tty=True, command=["start.sh", "bash", "-c", f"{package_manager} {version_arg}"] + tty=True, + command=["start.sh", "bash", "-c", f"{package_manager} {version_arg}"], ) rv = c.wait(timeout=5) logs = c.logs(stdout=True).decode("utf-8") diff --git a/base-notebook/test/test_pandoc.py b/base-notebook/test/test_pandoc.py index c84787c1..f0e33ab8 100644 --- a/base-notebook/test/test_pandoc.py +++ b/base-notebook/test/test_pandoc.py @@ -9,7 +9,8 @@ LOGGER = logging.getLogger(__name__) def test_pandoc(container): """Pandoc shall be able to convert MD to HTML.""" c = container.run( - tty=True, command=["start.sh", "bash", "-c", 'echo "**BOLD**" | pandoc'] + tty=True, + command=["start.sh", "bash", "-c", 'echo "**BOLD**" | pandoc'], ) c.wait(timeout=10) logs = c.logs(stdout=True).decode("utf-8") diff --git a/base-notebook/test/test_python.py b/base-notebook/test/test_python.py index 3e35d2b8..7dc8ef1f 100644 --- a/base-notebook/test/test_python.py +++ b/base-notebook/test/test_python.py @@ -10,7 +10,10 @@ LOGGER = logging.getLogger(__name__) def test_python_version(container, python_next_version="3.10"): """Check that python version is lower than the next version""" LOGGER.info(f"Checking that python version is lower than {python_next_version}") - c = container.run(tty=True, command=["start.sh"]) + c = container.run( + tty=True, + command=["start.sh"], + ) cmd = c.exec_run("python --version") output = cmd.output.decode("utf-8") actual_python_version = version.parse(output.split()[1]) diff --git a/base-notebook/test/test_start_container.py b/base-notebook/test/test_start_container.py index 32760185..9d3a8580 100644 --- a/base-notebook/test/test_start_container.py +++ b/base-notebook/test/test_start_container.py @@ -19,7 +19,11 @@ def test_start_notebook(container, http_client, env, expected_server): LOGGER.info( f"Test that the start-notebook launches the {expected_server} server from the env {env} ..." ) - 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") logs = c.logs(stdout=True).decode("utf-8") LOGGER.debug(logs) @@ -40,7 +44,10 @@ def test_tini_entrypoint(container, pid=1, command="tini"): 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} ...") - c = container.run(tty=True, command=["start.sh"]) + c = container.run( + tty=True, + command=["start.sh"], + ) # Select the PID 1 and get the corresponding command cmd = c.exec_run(f"ps -p {pid} -o comm=") output = cmd.output.decode("utf-8").strip("\n") diff --git a/datascience-notebook/test/test_julia.py b/datascience-notebook/test/test_julia.py index dd2cf15e..610fab3d 100644 --- a/datascience-notebook/test/test_julia.py +++ b/datascience-notebook/test/test_julia.py @@ -9,7 +9,8 @@ def test_julia(container): """Basic julia test""" LOGGER.info("Test that julia is correctly installed ...") running_container = container.run( - tty=True, command=["start.sh", "bash", "-c", "sleep infinity"] + tty=True, + command=["start.sh", "bash", "-c", "sleep infinity"], ) command = "julia --version" cmd = running_container.exec_run(command) diff --git a/minimal-notebook/test/test_inkscape.py b/minimal-notebook/test/test_inkscape.py index e8f50e2c..a39bcb15 100644 --- a/minimal-notebook/test/test_inkscape.py +++ b/minimal-notebook/test/test_inkscape.py @@ -10,7 +10,8 @@ def test_inkscape(container): """Inkscape shall be installed to be able to convert SVG files.""" LOGGER.info("Test that inkscape is working by printing its version ...") c = container.run( - tty=True, command=["start.sh", "bash", "-c", "inkscape --version"] + tty=True, + command=["start.sh", "bash", "-c", "inkscape --version"], ) c.wait(timeout=10) logs = c.logs(stdout=True).decode("utf-8") diff --git a/pyspark-notebook/test/test_spark.py b/pyspark-notebook/test/test_spark.py index a25a542d..1cfba7e0 100644 --- a/pyspark-notebook/test/test_spark.py +++ b/pyspark-notebook/test/test_spark.py @@ -9,7 +9,8 @@ LOGGER = logging.getLogger(__name__) def test_spark_shell(container): """Checking if Spark (spark-shell) is running properly""" c = container.run( - tty=True, command=["start.sh", "bash", "-c", 'spark-shell <<< "1+1"'] + tty=True, + command=["start.sh", "bash", "-c", 'spark-shell <<< "1+1"'], ) c.wait(timeout=60) logs = c.logs(stdout=True).decode("utf-8") diff --git a/scipy-notebook/test/test_extensions.py b/scipy-notebook/test/test_extensions.py index 3571a73c..03f80d5f 100644 --- a/scipy-notebook/test/test_extensions.py +++ b/scipy-notebook/test/test_extensions.py @@ -26,7 +26,8 @@ def test_check_extension(container, extension): """ LOGGER.info(f"Checking the extension: {extension} ...") c = container.run( - tty=True, command=["start.sh", "jupyter", "labextension", "check", extension] + tty=True, + command=["start.sh", "jupyter", "labextension", "check", extension], ) rv = c.wait(timeout=10) logs = c.logs(stdout=True).decode("utf-8") diff --git a/test/helpers.py b/test/helpers.py index a36cab06..98b8d75c 100644 --- a/test/helpers.py +++ b/test/helpers.py @@ -49,7 +49,8 @@ class CondaPackageHelper: """Start the TrackedContainer and return an instance of a running container""" LOGGER.info(f"Starting container {container.image_name} ...") return container.run( - tty=True, command=["start.sh", "bash", "-c", "sleep infinity"] + tty=True, + command=["start.sh", "bash", "-c", "sleep infinity"], ) @staticmethod