forked from runpod/runpod-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_version.py
More file actions
22 lines (16 loc) · 695 Bytes
/
test_version.py
File metadata and controls
22 lines (16 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
""" Test the version module """
from importlib.metadata import PackageNotFoundError
from unittest.mock import patch
from runpod.version import get_version
def test_version_found():
"""Test that the version is found"""
with patch("runpod.version.version") as mock_get_version:
mock_get_version.return_value = "1.0.0"
assert get_version() == "1.0.0"
assert mock_get_version.called
def test_version_not_found():
"""Test that the version is not found"""
with patch("runpod.version.version") as mock_get_version:
mock_get_version.side_effect = PackageNotFoundError
assert get_version() == "unknown"
assert mock_get_version.called