updating black formatting

Signed-off-by: Dixon Whitmire <dixonwh@gmail.com>
This commit is contained in:
Dixon Whitmire 2022-11-09 12:59:28 -05:00 committed by Muayyad Alsadi
parent 8d8df0bc28
commit 13856d2e9c
3 changed files with 43 additions and 36 deletions

View File

@ -1748,7 +1748,7 @@ class PodmanCompose:
help="Specify a profile to enable", help="Specify a profile to enable",
metavar="profile", metavar="profile",
action="append", action="append",
default=[] default=[],
) )
parser.add_argument( parser.add_argument(
"-p", "-p",

View File

@ -10,7 +10,7 @@ from test_podman_compose import capture
@pytest.fixture @pytest.fixture
def profile_compose_file(test_path): def profile_compose_file(test_path):
""""Returns the path to the `profile` compose file used for this test module""" """ "Returns the path to the `profile` compose file used for this test module"""
return os.path.join(test_path, "profile", "docker-compose.yml") return os.path.join(test_path, "profile", "docker-compose.yml")
@ -21,13 +21,7 @@ def test_config_no_profiles(podman_compose_path, profile_compose_file):
:param podman_compose_path: The fixture used to specify the path to the podman compose file. :param podman_compose_path: The fixture used to specify the path to the podman compose file.
:param profile_compose_file: The fixtued used to specify the path to the "profile" compose used in the test. :param profile_compose_file: The fixtued used to specify the path to the "profile" compose used in the test.
""" """
config_cmd = [ config_cmd = ["python3", podman_compose_path, "-f", profile_compose_file, "config"]
"python3",
podman_compose_path,
"-f",
profile_compose_file,
"config"
]
out, err, return_code = capture(config_cmd) out, err, return_code = capture(config_cmd)
assert return_code == 0 assert return_code == 0
@ -38,16 +32,26 @@ def test_config_no_profiles(podman_compose_path, profile_compose_file):
assert "service-2" not in string_output assert "service-2" not in string_output
@pytest.mark.parametrize("profiles, expected_services", @pytest.mark.parametrize(
[ "profiles, expected_services",
(["--profile", "profile-1", "config"], [
{"default-service": True, "service-1": True, "service-2": False}), (
(["--profile", "profile-2", "config"], ["--profile", "profile-1", "config"],
{"default-service": True, "service-1": False, "service-2": True}), {"default-service": True, "service-1": True, "service-2": False},
(["--profile", "profile-1", "--profile", "profile-2", "config"], ),
{"default-service": True, "service-1": True, "service-2": True}) (
]) ["--profile", "profile-2", "config"],
def test_config_profiles(podman_compose_path, profile_compose_file, profiles, expected_services): {"default-service": True, "service-1": False, "service-2": True},
),
(
["--profile", "profile-1", "--profile", "profile-2", "config"],
{"default-service": True, "service-1": True, "service-2": True},
),
],
)
def test_config_profiles(
podman_compose_path, profile_compose_file, profiles, expected_services
):
""" """
Tests podman-compose Tests podman-compose
:param podman_compose_path: The fixture used to specify the path to the podman compose file. :param podman_compose_path: The fixture used to specify the path to the podman compose file.
@ -56,12 +60,7 @@ def test_config_profiles(podman_compose_path, profile_compose_file, profiles, ex
:param expected_services: Dictionary used to model the expected "enabled" services in the profile. :param expected_services: Dictionary used to model the expected "enabled" services in the profile.
Key = service name, Value = True if the service is enabled, otherwise False. Key = service name, Value = True if the service is enabled, otherwise False.
""" """
config_cmd = [ config_cmd = ["python3", podman_compose_path, "-f", profile_compose_file]
"python3",
podman_compose_path,
"-f",
profile_compose_file
]
config_cmd.extend(profiles) config_cmd.extend(profiles)
out, err, return_code = capture(config_cmd) out, err, return_code = capture(config_cmd)

View File

@ -10,7 +10,7 @@ from test_podman_compose import capture
@pytest.fixture @pytest.fixture
def profile_compose_file(test_path): def profile_compose_file(test_path):
""""Returns the path to the `profile` compose file used for this test module""" """ "Returns the path to the `profile` compose file used for this test module"""
return os.path.join(test_path, "profile", "docker-compose.yml") return os.path.join(test_path, "profile", "docker-compose.yml")
@ -34,20 +34,28 @@ def teardown(podman_compose_path, profile_compose_file):
"profile-2", "profile-2",
"-f", "-f",
profile_compose_file, profile_compose_file,
"down" "down",
] ]
capture(down_cmd) capture(down_cmd)
@pytest.mark.parametrize("profiles, expected_services", @pytest.mark.parametrize(
[ "profiles, expected_services",
(["--profile", "profile-1", "up", "-d"], [
{"default-service": True, "service-1": True, "service-2": False}), (
(["--profile", "profile-2", "up", "-d"], ["--profile", "profile-1", "up", "-d"],
{"default-service": True, "service-1": False, "service-2": True}), {"default-service": True, "service-1": True, "service-2": False},
(["--profile", "profile-1", "--profile", "profile-2", "up", "-d"], ),
{"default-service": True, "service-1": True, "service-2": True}) (
]) ["--profile", "profile-2", "up", "-d"],
{"default-service": True, "service-1": False, "service-2": True},
),
(
["--profile", "profile-1", "--profile", "profile-2", "up", "-d"],
{"default-service": True, "service-1": True, "service-2": True},
),
],
)
def test_up(podman_compose_path, profile_compose_file, profiles, expected_services): def test_up(podman_compose_path, profile_compose_file, profiles, expected_services):
up_cmd = [ up_cmd = [
"python3", "python3",