mirror of
https://github.com/containers/podman-compose.git
synced 2025-08-19 09:51:47 +02:00
Format codebase with ruff
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
Defines global pytest fixtures available to all tests.
|
||||
"""
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
@@ -77,9 +77,7 @@ def test_podman_compose_extends_w_empty_service():
|
||||
"python3",
|
||||
str(main_path.joinpath("podman_compose.py")),
|
||||
"-f",
|
||||
str(
|
||||
main_path.joinpath("tests", "extends_w_empty_service", "docker-compose.yml")
|
||||
),
|
||||
str(main_path.joinpath("tests", "extends_w_empty_service", "docker-compose.yml")),
|
||||
"up",
|
||||
"-d",
|
||||
]
|
||||
|
@@ -3,6 +3,7 @@ test_podman_compose_config.py
|
||||
|
||||
Tests the podman-compose config command which is used to return defined compose services.
|
||||
"""
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
import os
|
||||
from test_podman_compose import capture
|
||||
@@ -50,9 +51,7 @@ def test_config_no_profiles(podman_compose_path, profile_compose_file):
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_config_profiles(
|
||||
podman_compose_path, profile_compose_file, profiles, expected_services
|
||||
):
|
||||
def test_config_profiles(podman_compose_path, profile_compose_file, profiles, expected_services):
|
||||
"""
|
||||
Tests podman-compose
|
||||
:param podman_compose_path: The fixture used to specify the path to the podman compose file.
|
||||
|
@@ -3,6 +3,7 @@ test_podman_compose_up_down.py
|
||||
|
||||
Tests the podman compose up and down commands used to create and remove services.
|
||||
"""
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
import os
|
||||
import time
|
||||
@@ -17,7 +18,7 @@ def test_exit_from(podman_compose_path, test_path):
|
||||
podman_compose_path,
|
||||
"-f",
|
||||
os.path.join(test_path, "exit-from", "docker-compose.yaml"),
|
||||
"up"
|
||||
"up",
|
||||
]
|
||||
|
||||
out, _, return_code = capture(up_cmd + ["--exit-code-from", "sh1"])
|
||||
@@ -42,7 +43,7 @@ def test_run(podman_compose_path, test_path):
|
||||
"sleep",
|
||||
"/bin/sh",
|
||||
"-c",
|
||||
"wget -q -O - http://web:8000/hosts"
|
||||
"wget -q -O - http://web:8000/hosts",
|
||||
]
|
||||
|
||||
out, _, return_code = capture(run_cmd)
|
||||
@@ -61,7 +62,7 @@ def test_run(podman_compose_path, test_path):
|
||||
"sleep",
|
||||
"/bin/sh",
|
||||
"-c",
|
||||
"wget -q -O - http://web:8000/hosts"
|
||||
"wget -q -O - http://web:8000/hosts",
|
||||
]
|
||||
|
||||
out, _, return_code = capture(run_cmd)
|
||||
@@ -83,8 +84,6 @@ def test_run(podman_compose_path, test_path):
|
||||
|
||||
|
||||
def test_up_with_ports(podman_compose_path, test_path):
|
||||
|
||||
|
||||
up_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
@@ -93,7 +92,7 @@ def test_up_with_ports(podman_compose_path, test_path):
|
||||
os.path.join(test_path, "ports", "docker-compose.yml"),
|
||||
"up",
|
||||
"-d",
|
||||
"--force-recreate"
|
||||
"--force-recreate",
|
||||
]
|
||||
|
||||
down_cmd = [
|
||||
@@ -103,21 +102,19 @@ def test_up_with_ports(podman_compose_path, test_path):
|
||||
"-f",
|
||||
os.path.join(test_path, "ports", "docker-compose.yml"),
|
||||
"down",
|
||||
"--volumes"
|
||||
"--volumes",
|
||||
]
|
||||
|
||||
try:
|
||||
out, _, return_code = capture(up_cmd)
|
||||
assert return_code == 0
|
||||
|
||||
|
||||
finally:
|
||||
out, _, return_code = capture(down_cmd)
|
||||
assert return_code == 0
|
||||
|
||||
|
||||
def test_down_with_vols(podman_compose_path, test_path):
|
||||
|
||||
up_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
@@ -125,7 +122,7 @@ def test_down_with_vols(podman_compose_path, test_path):
|
||||
"-f",
|
||||
os.path.join(test_path, "vol", "docker-compose.yaml"),
|
||||
"up",
|
||||
"-d"
|
||||
"-d",
|
||||
]
|
||||
|
||||
down_cmd = [
|
||||
@@ -135,7 +132,7 @@ def test_down_with_vols(podman_compose_path, test_path):
|
||||
"-f",
|
||||
os.path.join(test_path, "vol", "docker-compose.yaml"),
|
||||
"down",
|
||||
"--volumes"
|
||||
"--volumes",
|
||||
]
|
||||
|
||||
try:
|
||||
@@ -157,8 +154,20 @@ def test_down_with_vols(podman_compose_path, test_path):
|
||||
|
||||
|
||||
def test_down_with_orphans(podman_compose_path, test_path):
|
||||
|
||||
container_id, _ , return_code = capture(["podman", "run", "--rm", "-d", "busybox", "/bin/busybox", "httpd", "-f", "-h", "/etc/", "-p", "8000"])
|
||||
container_id, _, return_code = capture([
|
||||
"podman",
|
||||
"run",
|
||||
"--rm",
|
||||
"-d",
|
||||
"busybox",
|
||||
"/bin/busybox",
|
||||
"httpd",
|
||||
"-f",
|
||||
"-h",
|
||||
"/etc/",
|
||||
"-p",
|
||||
"8000",
|
||||
])
|
||||
|
||||
down_cmd = [
|
||||
"coverage",
|
||||
@@ -168,7 +177,7 @@ def test_down_with_orphans(podman_compose_path, test_path):
|
||||
os.path.join(test_path, "ports", "docker-compose.yml"),
|
||||
"down",
|
||||
"--volumes",
|
||||
"--remove-orphans"
|
||||
"--remove-orphans",
|
||||
]
|
||||
|
||||
out, _, return_code = capture(down_cmd)
|
||||
@@ -177,4 +186,3 @@ def test_down_with_orphans(podman_compose_path, test_path):
|
||||
_, _, exists = capture(["podman", "container", "exists", container_id.decode("utf-8")])
|
||||
|
||||
assert exists == 1
|
||||
|
||||
|
@@ -3,6 +3,7 @@ test_podman_compose_up_down.py
|
||||
|
||||
Tests the podman compose up and down commands used to create and remove services.
|
||||
"""
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
import os
|
||||
from test_podman_compose import capture
|
||||
|
Reference in New Issue
Block a user