Skip to content

Commit

Permalink
Revert "Run lint maturity on the transpiled release file"
Browse files Browse the repository at this point in the history
This reverts commit 094e2a3.
  • Loading branch information
sondreso committed Feb 1, 2024
1 parent 1536492 commit 0aeba65
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 47 deletions.
8 changes: 3 additions & 5 deletions komodo/lint_maturity.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ def msg_release_exception(release_basename, release_version):


def get_release_version(release_basename, tag_exceptions_release):
release_cleanname = release_basename.split("-")[0]

if release_cleanname not in tag_exceptions_release:
release_version = get_release_type(release_cleanname)
if release_basename not in tag_exceptions_release:
release_version = get_release_type(release_basename)
else:
release_version = "exception"

Expand All @@ -131,7 +129,7 @@ def run(files_to_lint: List[str], tag_exceptions):
system_warning_msg = ""

for file_to_lint in files_to_lint:
release_basename = os.path.basename(file_to_lint)
release_basename = ".".join(os.path.basename(file_to_lint).split(".")[0:-1])
release_version = get_release_version(
release_basename,
tag_exceptions["release"],
Expand Down
84 changes: 42 additions & 42 deletions tests/test_lint_maturity.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def _create_tmp_test_files(release_sample, file_names_sample):
@pytest.mark.parametrize(
("release_basename", "release_version", "count_tag_invalid"),
[
("2020.02.01-py38-rhel7.yml", "stable", 4),
("2020.02.a1-py38-rhel7.yml", "a", 1),
("2020.02.b1-py38-rhel7.yml", "b", 2),
("2020.02.rc1-py38-rhel7.yml", "rc", 3),
("2020.02.01.yml", "stable", 4),
("2020.02.a1.yml", "a", 1),
("2020.02.b1.yml", "b", 2),
("2020.02.rc1.yml", "rc", 3),
],
)
def test_msg_packages_invalid(release_basename, release_version, count_tag_invalid):
Expand All @@ -52,20 +52,20 @@ def test_msg_packages_invalid(release_basename, release_version, count_tag_inval
},
)

expected_system_exit = """2020.02.01-py38-rhel7.yml has 4 packages with invalid maturity tag.
expected_system_exit = """2020.02.01.yml has 4 packages with invalid maturity tag.
\tTag a packages: [('package_a1', 'v3.1.a1')]
\tTag b packages: [('package_b1', 'v3.1.b1')]
\tTag rc packages: [('package_rc1', 'v3.1.rc1')]
\tTag invalid packages: [('package_iv1', '5.13.1-src')]
2020.02.a1-py38-rhel7.yml has 1 packages with invalid maturity tag.
2020.02.a1.yml has 1 packages with invalid maturity tag.
\tTag invalid packages: [('package_iv1', '5.13.1-src')]
2020.02.b1-py38-rhel7.yml has 2 packages with invalid maturity tag.
2020.02.b1.yml has 2 packages with invalid maturity tag.
\tTag a packages: [('package_a1', 'v3.1.a1')]
\tTag invalid packages: [('package_iv1', '5.13.1-src')]
2020.02.rc1-py38-rhel7.yml has 3 packages with invalid maturity tag.
2020.02.rc1.yml has 3 packages with invalid maturity tag.
\tTag a packages: [('package_a1', 'v3.1.a1')]
\tTag b packages: [('package_b1', 'v3.1.b1')]
\tTag invalid packages: [('package_iv1', '5.13.1-src')]
Expand All @@ -77,10 +77,10 @@ def test_msg_packages_invalid(release_basename, release_version, count_tag_inval

def test_msg_packages_exception():
release_file_names = [
"2020.02.01-py38-rhel7.yml",
"2020.02.a1-py38-rhel7.yml",
"2020.02.b1-py38-rhel7.yml",
"2020.02.rc1-py38-rhel7.yml",
"2020.02.01.yml",
"2020.02.a1.yml",
"2020.02.b1.yml",
"2020.02.rc1.yml",
"bleeding.yml",
]

Expand Down Expand Up @@ -192,18 +192,18 @@ def test_read_yaml_file(tmpdir):
def test_msg_release_exception():
expected_release_version = ["stable", "a", "b", "rc", "exception"]
release_file_names = [
"2020.02.01-py38-rhel7.yml",
"2020.02.a1-py38-rhel7.yml",
"2020.02.b1-py38-rhel7.yml",
"2020.02.rc1-py38-rhel7.yml",
"bleeding-py38-rhel7.yml",
"2020.02.01.yml",
"2020.02.a1.yml",
"2020.02.b1.yml",
"2020.02.rc1.yml",
"bleeding.yml",
]

for count, release_basename in enumerate(release_file_names):
release_version = expected_release_version[count]
expected_warning_msg = ""

if release_basename == "bleeding-py38-rhel7.yml":
if release_basename == "bleeding.yml":
expected_warning_msg += (
release_basename + " not lint because it is in the exception list.\n"
)
Expand All @@ -219,10 +219,10 @@ def test_msg_release_exception():
@pytest.mark.parametrize(
("release_basename", "expected_release_version"),
[
("2020.02.01-py38-rhel7.yml", "stable"),
("2020.02.a1-py38-rhel7.yml", "a"),
("2020.02.b1-py38-rhel7.yml", "b"),
("2020.02.rc1-py38-rhel7.yml", "rc"),
("2020.02.01", "stable"),
("2020.02.a1", "a"),
("2020.02.b1", "b"),
("2020.02.rc1", "rc"),
("bleeding", "exception"),
("invalid_tag", "invalid"),
],
Expand All @@ -246,22 +246,22 @@ def test_lint_maturity_run(tmpdir):
package_iv1: 5.13.1-src
package_ex2: testing/2020.3/rc1""",
file_names_sample=[
"2020.02.01-py38-rhel7.yml",
"2020.02.a1-py38-rhel7.yml",
"2020.02.b1-py38-rhel7.yml",
"2020.02.rc1-py38-rhel7.yml",
"2020.02.01.yml",
"2020.02.a1.yml",
"2020.02.b1.yml",
"2020.02.rc1.yml",
],
)

expected_warning = """2020.02.01-py38-rhel7.yml, exception list of packages:
expected_warning = """2020.02.01, exception list of packages:
\t[('package_ex2', 'testing/2020.3/rc1')]
2020.02.a1-py38-rhel7.yml, exception list of packages:
2020.02.a1, exception list of packages:
\t[('package_ex2', 'testing/2020.3/rc1')]
2020.02.b1-py38-rhel7.yml, exception list of packages:
2020.02.b1, exception list of packages:
\t[('package_ex2', 'testing/2020.3/rc1')]
2020.02.rc1-py38-rhel7.yml, exception list of packages:
2020.02.rc1, exception list of packages:
\t[('package_ex2', 'testing/2020.3/rc1')]
bleeding-py38-rhel7.yml not lint because it is in the exception list.
bleeding not lint because it is in the exception list.
bleeding, exception list of packages:
\t[('package_ex2', 'testing/2020.3/rc1')]
bleeding has 4 packages with invalid maturity tag.
Expand All @@ -271,20 +271,20 @@ def test_lint_maturity_run(tmpdir):
\tTag invalid packages: [('package_iv1', '5.13.1-src')]
"""

expected_system_exit = """2020.02.01-py38-rhel7.yml has 4 packages with invalid maturity tag.
expected_system_exit = """2020.02.01 has 4 packages with invalid maturity tag.
\tTag a packages: [('package_a1', 'v3.1.a1')]
\tTag b packages: [('package_b1', 'v3.1.b1')]
\tTag rc packages: [('package_rc1', 'v3.1.rc1')]
\tTag invalid packages: [('package_iv1', '5.13.1-src')]
2020.02.a1-py38-rhel7.yml has 1 packages with invalid maturity tag.
2020.02.a1 has 1 packages with invalid maturity tag.
\tTag invalid packages: [('package_iv1', '5.13.1-src')]
2020.02.b1-py38-rhel7.yml has 2 packages with invalid maturity tag.
2020.02.b1 has 2 packages with invalid maturity tag.
\tTag a packages: [('package_a1', 'v3.1.a1')]
\tTag invalid packages: [('package_iv1', '5.13.1-src')]
2020.02.rc1-py38-rhel7.yml has 3 packages with invalid maturity tag.
2020.02.rc1 has 3 packages with invalid maturity tag.
\tTag a packages: [('package_a1', 'v3.1.a1')]
\tTag b packages: [('package_b1', 'v3.1.b1')]
\tTag invalid packages: [('package_iv1', '5.13.1-src')]
Expand Down Expand Up @@ -312,11 +312,11 @@ def test_get_files_to_lint(tmpdir):
list_files_expected = _create_tmp_test_files(
release_sample="pytest: 3.1.2",
file_names_sample=[
"2020.02.01-py38-rhel7.yml",
"2020.02.a1-py38-rhel7.yml",
"2020.02.b1-py38-rhel7.yml",
"2020.02.rc1-py38-rhel7.yml",
"bleeding-py38-rhel7.yml",
"2020.02.01.yml",
"2020.02.a1.yml",
"2020.02.b1.yml",
"2020.02.rc1.yml",
"bleeding.yml",
],
)

Expand Down Expand Up @@ -418,7 +418,7 @@ def test_integration_main(monkeypatch, tmpdir):
package_st1: v0.10.4
package_iv1: 5.13.1-src
package_ex2: testing/2020.3/rc1""",
file_names_sample=["2020.02.01-py38-rhel7.yml"],
file_names_sample=["2020.02.01.yml"],
)
monkeypatch.setattr(
sys,
Expand Down Expand Up @@ -468,7 +468,7 @@ def test_argument_types(yaml_string: str, expectation, monkeypatch, tmpdir):
with tmpdir.as_cwd():
list_files_expected = _create_tmp_test_files(
release_sample=yaml_string,
file_names_sample=["2020.02.01-py38-rhel7.yml"],
file_names_sample=["2020.02.01.yml"],
)
monkeypatch.setattr(sys, "argv", ["", "--release_file", list_files_expected[0]])
with expectation:
Expand Down

0 comments on commit 0aeba65

Please sign in to comment.