Skip to content

Commit

Permalink
use of f strings
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Mar 13, 2024
1 parent 3a815a1 commit d4fc280
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 39 deletions.
4 changes: 1 addition & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ def komodo_root(tmp_path_factory, python38_path):

path = tmp_path_factory.mktemp("prog-res-komodo")

rhel_ver = rhel_version()

# Install and configure pythons
_install(python38_path, path / "2030.01.00-py38", ["numpy==1.18.4"])
_install(python38_path, path / "2030.01.01-py38", ["numpy==1.19.1"])
_install(python38_path, path / "2030.02.00-py38")
_install(python38_path, path / "2030.03.00-py38-rhel9")
_install(python38_path, path / f"bleeding-py38-rhel{rhel_ver}")
_install(python38_path, path / f"bleeding-py38-rhel{rhel_version()}")

for chain in (
("2030.01", "2030.01-py3", "2030.01-py38", "2030.01.00-py38"),
Expand Down
46 changes: 10 additions & 36 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,16 @@ def generate_test_params_simple(rhel_version):
("2030.01.00-py38", "stable-py38", "stable-py38"),
("2030.01.00-py38", "stable-py38", "2030.01"),
("2030.01.00-py38", "stable-py38", "2030.01.00-py38"),
(f"bleeding-py38-rhel{rhel_version}", "bleeding-py38", "bleeding"),
(f"bleeding-py38-rhel{rhel_version}", "bleeding-py38", "bleeding-py3"),
(f"bleeding-py38-rhel{rhel_version}", "bleeding-py38", "bleeding-py38"),
]
if rhel_version == "7":
base_params.extend(
[
("bleeding-py38-rhel7", "bleeding-py38", "bleeding"),
("bleeding-py38-rhel7", "bleeding-py38", "bleeding-py3"),
("bleeding-py38-rhel7", "bleeding-py38", "bleeding-py38"),
]
)
elif rhel_version == "8":
base_params.extend(
[
("bleeding-py38-rhel8", "bleeding-py38", "bleeding"),
("bleeding-py38-rhel8", "bleeding-py38", "bleeding-py3"),
("bleeding-py38-rhel8", "bleeding-py38", "bleeding-py38"),
]
)
return base_params


@pytest.mark.parametrize(
"expect,track_name,name",
generate_test_params_simple(rhel_version),
"expect, track_name,name",
generate_test_params_simple(rhel_version()),
)
def test_resolve_simple(komodo_root, track_name, name, expect):
release, tracked = main.resolve_release(komodo_root, name)
Expand Down Expand Up @@ -81,29 +68,16 @@ def generate_test_params_no_update(rhel_version):
("2030.01.00-py38", "2030.01"),
("2030.01.00-py38", "2030.01.00-py38"),
("2030.01.01-py38", "2030.01.01-py38"),
(f"bleeding-py38-rhel{rhel_version}", "bleeding"),
(f"bleeding-py38-rhel{rhel_version}", "bleeding-py3"),
(f"bleeding-py38-rhel{rhel_version}", "bleeding-py38"),
]
if rhel_version == "7":
base_params.extend(
[
("bleeding-py38-rhel7", "bleeding"),
("bleeding-py38-rhel7", "bleeding-py3"),
("bleeding-py38-rhel7", "bleeding-py38"),
]
)
elif rhel_version == "8":
base_params.extend(
[
("bleeding-py38-rhel8", "bleeding"),
("bleeding-py38-rhel8", "bleeding-py3"),
("bleeding-py38-rhel8", "bleeding-py38"),
]
)
return base_params


@pytest.mark.parametrize(
"expect,name",
generate_test_params_no_update(rhel_version),
"expect, name",
generate_test_params_no_update(rhel_version()),
)
def test_resolve_no_update(komodo_root, expect, name):
release, tracked = main.resolve_release(komodo_root, name, no_update=True)
Expand Down

0 comments on commit d4fc280

Please sign in to comment.