Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions main/settings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"""

import importlib
import re
import sys
import tomllib
from unittest import mock

import pytest
import semantic_version
from django.conf import settings
from django.core import mail
from django.core.exceptions import ImproperlyConfigured
Expand Down Expand Up @@ -162,12 +163,17 @@ def test_opensearch_index_pr_build(self):
settings_vars = self.reload_settings()
assert settings_vars["OPENSEARCH_INDEX"] == index_name

@staticmethod
def test_semantic_version():
"""
Verify that we have a semantic compatible version.
"""
semantic_version.Version(settings.VERSION)
def test_bump_my_version_format(self):
"""Verify VERSION is in sync with pyproject.toml and matches a version format."""
with open("pyproject.toml", "rb") as f: # noqa: PTH123
pyproject = tomllib.load(f)
version_pattern = pyproject["tool"]["bumpversion"]["parse"]
package_version = pyproject["project"]["version"]
assert package_version == settings.VERSION
semver_pattern = r"[0-9]+\.[0-9]+\.[0-9]+"
assert re.fullmatch(version_pattern, settings.VERSION) or re.fullmatch(
semver_pattern, settings.VERSION
), f'VERSION "{settings.VERSION}" does not match calver or semver format'

def test_required_settings(self):
"""
Expand Down
35 changes: 34 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mit-learn"
version = "0.71.0"
version = "0.70.10"
description = "Search index for use with other MIT applications."
authors = [{ name = "MIT ODL" }]
requires-python = ">=3.12,<3.13"
Expand Down Expand Up @@ -263,3 +263,36 @@ inline-quotes = "double"
"*_test.py" = ["ARG001", "E501", "S101", "PLR2004"]
"test_*.py" = ["ARG001", "E501", "S101", "PLR2004"]
"**/migrations/**" = ["ARG001"]

[tool.bumpversion]
commit = false
tag = false
parse = "(?P<release>(?:[1-9][0-9]{3})\\.(?:1[0-2]|[1-9])\\.(?:3[0-1]|[12][0-9]|[1-9]))\\.(?P<build>\\d+)"
serialize = ["{release}.{build}"]

[tool.bumpversion.parts.release]
calver_format = "{YYYY}.{MM}.{DD}"

[tool.bumpversion.parts.build]
first_value = "1"

[[tool.bumpversion.files]]
filename = "main/settings.py"
search = 'VERSION = "{current_version}"'
replace = 'VERSION = "{new_version}"'

[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = 'version = "{current_version}"'
replace = 'version = "{new_version}"'

[[tool.bumpversion.files]]
filename = "uv.lock"
search = """
name = "mit-learn"
version = "{current_version}"
source = {{ virtual = "." }}"""
replace = """
name = "mit-learn"
version = "{new_version}"
source = {{ virtual = "." }}"""
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading