22Validate that our settings functions work
33"""
44
5+ import re
56import sys
7+ import tomllib
68from types import SimpleNamespace
79
810import pytest
9- import semantic_version
1011from django .core import mail
1112from django .core .exceptions import ImproperlyConfigured
1213from mitol .common import envs
@@ -158,13 +159,6 @@ def test_db_ssl_enable(monkeypatch, settings_sandbox):
158159 assert settings_vars ["DATABASES" ]["default" ]["OPTIONS" ] == {"sslmode" : "require" }
159160
160161
161- def test_semantic_version (settings ):
162- """
163- Verify that we have a semantic compatible version.
164- """
165- semantic_version .Version (settings .VERSION )
166-
167-
168162def test_server_side_cursors_disabled (settings_sandbox ):
169163 """DISABLE_SERVER_SIDE_CURSORS should be true by default"""
170164 settings_vars = settings_sandbox .get ()
@@ -179,3 +173,16 @@ def test_server_side_cursors_enabled(settings_sandbox):
179173 assert (
180174 settings_vars ["DEFAULT_DATABASE_CONFIG" ]["DISABLE_SERVER_SIDE_CURSORS" ] is False
181175 )
176+
177+
178+ def test_bump_my_version_format (settings ):
179+ """Verify VERSION is in sync with pyproject.toml and matches a version format."""
180+ with open ("pyproject.toml" , "rb" ) as f : # noqa: PTH123
181+ pyproject = tomllib .load (f )
182+ version_pattern = pyproject ["tool" ]["bumpversion" ]["parse" ]
183+ package_version = pyproject ["project" ]["version" ]
184+ assert package_version == settings .VERSION
185+ semver_pattern = r"[0-9]+\.[0-9]+\.[0-9]+"
186+ assert re .fullmatch (version_pattern , settings .VERSION ) or re .fullmatch (
187+ semver_pattern , settings .VERSION
188+ ), f'VERSION "{ settings .VERSION } " does not match calver or semver format'
0 commit comments