11"""
22Tests specific to releasing a version of databento-python.
33"""
4+ from __future__ import annotations
5+
46import operator
57import re
68from datetime import date
79
810import databento
911import pytest
12+ import tomli
1013
1114from tests import PROJECT_ROOT
1215
@@ -28,13 +31,29 @@ def fixture_changelog() -> str:
2831 return changelog .read ()
2932
3033
34+ @pytest .fixture (name = "pyproject_version" )
35+ def fixture_pyproject_version () -> str :
36+ """
37+ Fixture for the version text of project.toml.
38+
39+ Returns
40+ -------
41+ str
42+
43+ """
44+ with open (PROJECT_ROOT / "pyproject.toml" , "rb" ) as pyproject :
45+ data = tomli .load (pyproject )
46+ return data ["tool" ]["poetry" ]["version" ]
47+
3148@pytest .mark .release
32- def test_release_changelog (changelog : str ) -> None :
49+ def test_release_changelog (changelog : str , pyproject_version : str ) -> None :
3350 """
34- Test that CHANGELOG.md contains correct version information.
51+ Test that CHANGELOG.md and pyproject.toml contain correct version
52+ information.
3553
3654 This test verifies that:
37- - The version in `version.py` matches the latest release note.
55+ - The version in `version.py` matches the latest release note
56+ - The version in `version.py` matches the version in `pyproject.toml`
3857 - The versions are unique.
3958 - The versions are ascending.
4059 - The release dates are chronological.
@@ -59,6 +78,9 @@ def test_release_changelog(changelog: str) -> None:
5978 # Ensure latest version matches `__version__`
6079 assert databento .__version__ == versions [0 ]
6180
81+ # Ensure latest version matches pyproject.toml
82+ assert databento .__version__ == pyproject_version
83+
6284 # Ensure versions are unique
6385 assert len (versions ) == len (set (versions ))
6486
0 commit comments