Skip to content

Commit

Permalink
add ModuleNotFoundError exception for self version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ArieLevs committed Mar 9, 2024
1 parent d9a6ed4 commit ce5b91a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pybump.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from sys import stderr

from ruamel.yaml import YAML, YAMLError

try:
from .pybump_version import PybumpVersion
except ImportError:
Expand Down Expand Up @@ -57,9 +58,12 @@ def get_self_version(dist_name):
:param dist_name: string
:return: version as string
"""
# https://docs.python.org/3/library/importlib.metadata.html#distribution-versions
from importlib.metadata import version
return version(dist_name)
try:
# https://docs.python.org/3/library/importlib.metadata.html#distribution-versions
from importlib.metadata import version
return version(dist_name)
except ModuleNotFoundError:

Check warning on line 65 in src/pybump.py

View check run for this annotation

Codecov / codecov/patch

src/pybump.py#L63-L65

Added lines #L63 - L65 were not covered by tests
return 'version not found'


def write_version_to_file(file_path, file_content, version, app_version):
Expand Down

0 comments on commit ce5b91a

Please sign in to comment.