black style tweaks: add trailing commas

This commit is contained in:
Erik Sundell
2021-06-28 15:09:13 +02:00
committed by Erik Sundell
parent 962a630f53
commit 411663b5d4
10 changed files with 41 additions and 13 deletions

View File

@@ -51,7 +51,10 @@ def test_uid_change(container):
def test_gid_change(container): def test_gid_change(container):
"""Container should change the GID of the default user.""" """Container should change the GID of the default user."""
c = container.run( 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) c.wait(timeout=10)
logs = c.logs(stdout=True).decode("utf-8") logs = c.logs(stdout=True).decode("utf-8")
@@ -160,7 +163,11 @@ def test_sudo_path(container):
def test_sudo_path_without_grant(container): def test_sudo_path_without_grant(container):
"""Container should include /opt/conda/bin in the sudo secure_path.""" """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) rv = c.wait(timeout=10)
assert rv == 0 or rv["StatusCode"] == 0 assert rv == 0 or rv["StatusCode"] == 0
logs = c.logs(stdout=True).decode("utf-8") 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 """Container should run with the specified uid, gid, and secondary
group. 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) rv = c.wait(timeout=5)
assert rv == 0 or rv["StatusCode"] == 0 assert rv == 0 or rv["StatusCode"] == 0
logs = c.logs(stdout=True).decode("utf-8") logs = c.logs(stdout=True).decode("utf-8")

View File

@@ -23,7 +23,8 @@ def test_package_manager(container, package_manager, version_arg):
f"Test that the package manager {package_manager} is working properly ..." f"Test that the package manager {package_manager} is working properly ..."
) )
c = container.run( 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) rv = c.wait(timeout=5)
logs = c.logs(stdout=True).decode("utf-8") logs = c.logs(stdout=True).decode("utf-8")

View File

@@ -9,7 +9,8 @@ LOGGER = logging.getLogger(__name__)
def test_pandoc(container): def test_pandoc(container):
"""Pandoc shall be able to convert MD to HTML.""" """Pandoc shall be able to convert MD to HTML."""
c = container.run( 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) c.wait(timeout=10)
logs = c.logs(stdout=True).decode("utf-8") logs = c.logs(stdout=True).decode("utf-8")

View File

@@ -10,7 +10,10 @@ LOGGER = logging.getLogger(__name__)
def test_python_version(container, python_next_version="3.10"): def test_python_version(container, python_next_version="3.10"):
"""Check that python version is lower than the next version""" """Check that python version is lower than the next version"""
LOGGER.info(f"Checking that python version is lower than {python_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") cmd = c.exec_run("python --version")
output = cmd.output.decode("utf-8") output = cmd.output.decode("utf-8")
actual_python_version = version.parse(output.split()[1]) actual_python_version = version.parse(output.split()[1])

View File

@@ -19,7 +19,11 @@ def test_start_notebook(container, http_client, env, expected_server):
LOGGER.info( LOGGER.info(
f"Test that the start-notebook launches the {expected_server} server from the env {env} ..." 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") resp = http_client.get("http://localhost:8888")
logs = c.logs(stdout=True).decode("utf-8") logs = c.logs(stdout=True).decode("utf-8")
LOGGER.debug(logs) 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 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} ...") 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 # Select the PID 1 and get the corresponding command
cmd = c.exec_run(f"ps -p {pid} -o comm=") cmd = c.exec_run(f"ps -p {pid} -o comm=")
output = cmd.output.decode("utf-8").strip("\n") output = cmd.output.decode("utf-8").strip("\n")

View File

@@ -9,7 +9,8 @@ def test_julia(container):
"""Basic julia test""" """Basic julia test"""
LOGGER.info("Test that julia is correctly installed ...") LOGGER.info("Test that julia is correctly installed ...")
running_container = container.run( 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" command = "julia --version"
cmd = running_container.exec_run(command) cmd = running_container.exec_run(command)

View File

@@ -10,7 +10,8 @@ def test_inkscape(container):
"""Inkscape shall be installed to be able to convert SVG files.""" """Inkscape shall be installed to be able to convert SVG files."""
LOGGER.info("Test that inkscape is working by printing its version ...") LOGGER.info("Test that inkscape is working by printing its version ...")
c = container.run( 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) c.wait(timeout=10)
logs = c.logs(stdout=True).decode("utf-8") logs = c.logs(stdout=True).decode("utf-8")

View File

@@ -9,7 +9,8 @@ LOGGER = logging.getLogger(__name__)
def test_spark_shell(container): def test_spark_shell(container):
"""Checking if Spark (spark-shell) is running properly""" """Checking if Spark (spark-shell) is running properly"""
c = container.run( 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) c.wait(timeout=60)
logs = c.logs(stdout=True).decode("utf-8") logs = c.logs(stdout=True).decode("utf-8")

View File

@@ -26,7 +26,8 @@ def test_check_extension(container, extension):
""" """
LOGGER.info(f"Checking the extension: {extension} ...") LOGGER.info(f"Checking the extension: {extension} ...")
c = container.run( 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) rv = c.wait(timeout=10)
logs = c.logs(stdout=True).decode("utf-8") logs = c.logs(stdout=True).decode("utf-8")

View File

@@ -49,7 +49,8 @@ class CondaPackageHelper:
"""Start the TrackedContainer and return an instance of a running container""" """Start the TrackedContainer and return an instance of a running container"""
LOGGER.info(f"Starting container {container.image_name} ...") LOGGER.info(f"Starting container {container.image_name} ...")
return container.run( return container.run(
tty=True, command=["start.sh", "bash", "-c", "sleep infinity"] tty=True,
command=["start.sh", "bash", "-c", "sleep infinity"],
) )
@staticmethod @staticmethod