Skip to content

Commit

Permalink
Remove unused lint_release_name
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Apr 4, 2024
1 parent 1c4f956 commit 5f0b13e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 78 deletions.
44 changes: 0 additions & 44 deletions komodo/yaml_file_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,6 @@ def validate_release_file(release_file_content: Mapping) -> None:
errors.extend(error)
handle_validation_errors(errors, message)

@staticmethod
def lint_release_name(packagefile_path: str) -> List[KomodoError]:
relname = os.path.basename(packagefile_path)
found = False
for py_suffix in "-py27", "-py36", "-py38", "-py311":
for rh_suffix in "", "-rhel6", "-rhel7", "-rhel8":
if relname.endswith(py_suffix + rh_suffix + ".yml"):
found = True
break
if not found:
return [
_komodo_error(
package=packagefile_path,
err=(
"Invalid release name suffix. "
"Must be of the form -pyXX[X] or -pyXX[X]-rhelY"
),
),
]

return []


class ReleaseMatrixFile(YamlFile):
"""Return the data from 'release' YAML file, but validate it first."""
Expand Down Expand Up @@ -157,28 +135,6 @@ def validate_release_matrix_file(release_matrix_file_content: Mapping) -> None:
_recursive_validate_version_matrix(package_version, package_name, errors)
handle_validation_errors(errors, message)

@staticmethod
def lint_release_name(packagefile_path: str) -> List[KomodoError]:
relname = os.path.basename(packagefile_path)
found = False
for py_suffix in "-py27", "-py36", "-py38", "-py311":
for rh_suffix in "", "-rhel6", "-rhel7", "-rhel8":
if relname.endswith(py_suffix + rh_suffix + ".yml"):
found = True
break
if not found:
return [
_komodo_error(
package=packagefile_path,
err=(
"Invalid release name suffix. "
"Must be of the form -pyXX[X] or -pyXX[X]-rhelY"
),
),
]

return []


class ReleaseDir:
def __call__(self, value: str) -> Dict[str, YamlFile]:
Expand Down
2 changes: 0 additions & 2 deletions tests/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from komodo import lint
from komodo.yaml_file_types import ReleaseFile, RepositoryFile

lint_release_name = ReleaseFile.lint_release_name

REPO = {
"python": {
"v3.14": {
Expand Down
32 changes: 0 additions & 32 deletions tests/test_yaml_file_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,38 +67,6 @@ def test_release_file_yaml_type(content, expectations):
ReleaseFile().from_yaml_string(content)


@pytest.mark.parametrize(
"valid",
(
"bleeding-py36.yml",
"/home/anyuser/komodo/2020.01.03-py36-rhel6.yml",
"myrelease-py36.yml",
"myrelease-py311.yml",
"myrelease-py311-rhel8.yml",
"myrelease-py36-rhel6.yml",
"myrelease-py36-rhel7.yml",
),
)
def test_release_name_valid(valid):
assert ReleaseFile.lint_release_name(valid) == []


@pytest.mark.parametrize(
"invalid",
(
"bleeding",
"bleeding.yml",
"2020.01.01",
"2020.01.00.yml",
"/home/anyuser/komodo-releases/releases/2020.01.00.yml",
"bleeding-py36",
"bleeding-rhel6.yml",
),
)
def test_release_name_invalid(invalid):
assert ReleaseFile.lint_release_name(invalid) != []


VALID_REPOSITORY = """
zopfli:
"0.3":
Expand Down

0 comments on commit 5f0b13e

Please sign in to comment.