Skip to content

Commit

Permalink
handle pre-releases a different way
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-D-Lewis committed Dec 30, 2024
1 parent f7d802e commit d41ab8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/_nebari/config_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ class ConfigSetMetadata(BaseModel):
def validate_version_requirement(cls, version_req):
if isinstance(version_req, str):
version_req = SpecifierSet(version_req, prereleases=True)
if version_req.prereleases is not True:
logger.warning(
"ConfigSetMetadata created with nebari_version SpecifierSet not allowing pre-releases."
)

return version_req

def check_version(self, version):
if version not in self.nebari_version:
if not self.nebari_version.contains(version, prereleases=True):
raise ValueError(
f'Nebari version "{version}" is not compatible with '
f'version requirement {self.nebari_version} for "{self.name}" config set.'
Expand Down
8 changes: 4 additions & 4 deletions tests/tests_unit/test_config_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
[
# Standard version tests
(">=2024.12.0,<2025.0.0", "2024.12.2", True),
(SpecifierSet(">=2024.12.0,<2025.0.0", prereleases=True), "2024.12.2", True),
(SpecifierSet(">=2024.12.0,<2025.0.0"), "2024.12.2", True),
# Pre-release version requirement tests
(">=2024.12.0rc1,<2025.0.0", "2024.12.0rc1", True),
(SpecifierSet(">=2024.12.0rc1", prereleases=True), "2024.12.0rc2", True),
(SpecifierSet(">=2024.12.0rc1"), "2024.12.0rc2", True),
# Pre-release test version against standard requirement
(">=2024.12.0,<2025.0.0", "2024.12.1rc1", True),
(SpecifierSet(">=2024.12.0,<2025.0.0", prereleases=True), "2024.12.1rc1", True),
(SpecifierSet(">=2024.12.0,<2025.0.0"), "2024.12.1rc1", True),
# Failing cases
(">=2025.0.0", "2024.12.2rc1", False),
(SpecifierSet(">=2025.0.0rc1", prereleases=True), "2024.12.2", False),
(SpecifierSet(">=2025.0.0rc1"), "2024.12.2", False),
],
)
def test_version_requirement(version_input, test_version, should_pass):
Expand Down

0 comments on commit d41ab8a

Please sign in to comment.