Skip to content

Commit

Permalink
Adds suggest deprecated symlink capability
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-el committed Dec 5, 2024
1 parent a7aaa99 commit 447bbde
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
2 changes: 1 addition & 1 deletion komodo/symlink/suggester/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _parse_args():
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument("release", help="e.g. 2019.12.rc0-py38")
parser.add_argument("mode", help="stable,testing")
parser.add_argument("mode", help="stable,testing,deprecated")
parser.add_argument("joburl", help="link to the job that triggered this")
parser.add_argument("jobname", help="name of the job")
parser.add_argument("--git-fork", help="git fork", default="equinor")
Expand Down
2 changes: 1 addition & 1 deletion komodo/symlink/suggester/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def update(self, release, mode, python_versions: List[str]):
self.links[link] = release.month_alias()
else:
self.links[link] = repr(release)
elif mode == "stable":
elif mode == "stable" or mode == "deprecated":
self.links[release.month_alias()] = repr(release)
self.links[link] = release.month_alias()
else:
Expand Down
66 changes: 64 additions & 2 deletions tests/test_suggester.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,32 @@ def test_get_concrete_release(conf, link, concrete):
"testing-py37": "2021.01-py37"
}
}
""",
),
# suggest deprecated update after skipped month
(
"""{"links": {
"2020.11-py37": "2020.11.04-py37",
"2020.12-py37": "2020.12.rc2-py37",
"stable-py3": "stable-py37",
"stable-py37": "2020.11-py37",
"deprecated-py3": "deprecated-py37",
"deprecated-py37": "2020.12-py37"
}}""",
"2021.01.rc3-py37",
"deprecated",
"changed",
"""{
"links": {
"2020.11-py37": "2020.11.04-py37",
"2020.12-py37": "2020.12.rc2-py37",
"2021.01-py37": "2021.01.rc3-py37",
"deprecated-py3": "deprecated-py37",
"deprecated-py37": "2021.01-py37",
"stable-py3": "stable-py37",
"stable-py37": "2020.11-py37"
}
}
""",
),
],
Expand All @@ -255,13 +281,17 @@ def _mock_repo(sym_config):
[
("foo.json", "stable"),
("foo_azure.json", "stable"),
("foo.json", "deprecated"),
("foo.json", "testing")
],
)
def test_suggest_symlink_configuration(symlink_file, mode):
"""Testing whether when updating symlink file the branch gets a corresponding name."""
config = """{"links": {
"2050.02-py58": "2050.02.00-py58",
"stable-py58": "2050.02-py58"
"deprecated-py58": "2050.02-py58",
"stable-py58": "2050.02-py58",
"testing-py58": "2050.02-py58"
}}"""
repo = _mock_repo(config)

Expand All @@ -288,7 +318,9 @@ def test_suggest_symlink_configuration(symlink_file, mode):
"""{
"links": {
"2050.02-py58": "2050.02.01-py58",
"stable-py58": "2050.02-py58"
"deprecated-py58": "2050.02-py58",
"stable-py58": "2050.02-py58",
"testing-py58": "2050.02-py58"
}
}
""",
Expand Down Expand Up @@ -388,6 +420,36 @@ def test_suggest_symlink_multi_configuration():
"testing-py38": "2001.12.rc0-py38"
}
}
""",
),
# testing deprecated promotion from previous release
(
"""{"links": {
"2001.11-py38": "2001.11.00-py38",
"2001.11-py311": "2001.11.00-py311",
"deprecated-py38": "2001.11.rc0-py38",
"deprecated-py311": "2001.11.rc0-py311",
"stable-py38" : "2001.11-py38",
"testing-py38": "2001.11.rc0-py38",
"stable-py311" : "2001.11-py311",
"testing-py311": "2001.11.rc0-py311"}}""",
"2001.12.rc0",
"deprecated",
"changed",
"""{
"links": {
"2001.11-py311": "2001.11.00-py311",
"2001.11-py38": "2001.11.00-py38",
"2001.12-py311": "2001.12.rc0-py311",
"2001.12-py38": "2001.12.rc0-py38",
"deprecated-py311": "2001.12-py311",
"deprecated-py38": "2001.12-py38",
"stable-py311": "2001.11-py311",
"stable-py38": "2001.11-py38",
"testing-py311": "2001.11.rc0-py311",
"testing-py38": "2001.11.rc0-py38"
}
}
""",
),
],
Expand Down

0 comments on commit 447bbde

Please sign in to comment.