sherlock/tests/test_version.py

17 lines
705 B
Python
Raw Normal View History

2024-05-21 03:35:45 +00:00
import os
2024-05-20 08:44:52 +00:00
from sherlock_interactives import Interactives
2024-06-24 20:40:03 +00:00
import sherlock_project
2024-05-20 08:44:52 +00:00
def test_versioning() -> None:
# Ensure __version__ matches version presented to the user
2024-06-24 20:40:03 +00:00
assert sherlock_project.__version__ in Interactives.run_cli("--version")
2024-05-20 08:44:52 +00:00
# Ensure __init__ is single source of truth for __version__ in package
# Temporarily allows sherlock.py so as to not trigger early upgrades
2024-05-21 03:35:45 +00:00
found:list = Interactives.walk_sherlock_for_files_with(r'__version__ *= *')
expected:list = [
# Normalization is REQUIRED for Windows ( / vs \ )
2024-06-24 21:04:50 +00:00
os.path.normpath("sherlock_project/__init__.py"),
2024-05-21 03:35:45 +00:00
]
# Sorting is REQUIRED for Mac
assert sorted(found) == sorted(expected)