-
-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for version number matching
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |