/
githubmirror
/
gpt-pilot
Обзор
Документация
Войти
/
githubmirror
/
gpt-pilot
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/config/test_version.py
26 строк
893 B
Senko Rasic
merge gpt-pilot 0.2 codebase
22 май 2024, 22:42
22 май 2024, 22:42
5b474cc
Код
Авторство
О чём код?
from os.path import dirname, join from subprocess import check_output from unittest.mock import patch from core.config.version import get_git_commit, get_package_version, get_version def test_get_package_version(): with open(join(dirname(__file__), "..", "..", "pyproject.toml"), "r", encoding="utf-8") as f: pyproject_toml = f.read() version = get_package_version() assert version in pyproject_toml def test_get_git_version(): commit_from_git = check_output(["git", "rev-parse", "HEAD"]).decode("utf-8").strip() git_commit = get_git_commit() assert git_commit == commit_from_git @patch("core.config.version.get_git_commit", return_value="abc") @patch("core.config.version.get_package_version", return_value="1.2.3") def test_get_version(_mock_get_package_version, _mock_get_git_commit): version = get_version() assert version == "1.2.3-gitabc"