Add tests for version number matching

This commit is contained in:
Nathan Thomas 2024-01-10 16:56:39 -08:00
parent 63f3901eaf
commit 577d914e93
3 changed files with 43 additions and 0 deletions

View File

@ -2,3 +2,4 @@ from . import converter, db, exceptions, media, metadata
from .config import Config
__all__ = ["Config", "media", "metadata", "converter", "db", "exceptions"]
__version__ = "2.0.2"

Binary file not shown.

42
tests/test_versions.py Normal file
View File

@ -0,0 +1,42 @@
import re
import pytest
from streamrip import __version__ as init_version
from streamrip.config import CURRENT_CONFIG_VERSION
toml_version_re = re.compile(r'version\s*\=\s*"([\d\.]+)"')
@pytest.fixture
def pyproject_version() -> str:
with open("pyproject.toml") as f:
m = toml_version_re.search(f.read())
assert m is not None
return m.group(1)
@pytest.fixture
def config_version() -> str | None:
with open("streamrip/config.toml") as f:
m = toml_version_re.search(f.read())
assert m is not None
return m.group(1)
@pytest.fixture
def click_version() -> str | None:
r = re.compile(r'\@click\.version_option\(version="([\d\.]+)"\)')
with open("streamrip/rip/cli.py") as f:
m = r.search(f.read())
assert m is not None
return m.group(1)
def test_config_versions_match(config_version):
assert config_version == CURRENT_CONFIG_VERSION
def test_streamrip_versions_match(pyproject_version, click_version):
assert pyproject_version == click_version
assert click_version == init_version