Skip to content

Commit

Permalink
Catch PackageNotFoundError
Browse files Browse the repository at this point in the history
  • Loading branch information
georgek committed Aug 24, 2023
1 parent 85a435f commit 148bac4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions widget_tweaks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from importlib.metadata import version
from importlib.metadata import version, PackageNotFoundError

__version__ = version("django-widget-tweaks")
try:
__version__ = version("django-widget-tweaks")
except PackageNotFoundError:

Check warning on line 5 in widget_tweaks/__init__.py

View check run for this annotation

Codecov / codecov/patch

widget_tweaks/__init__.py#L5

Added line #L5 was not covered by tests
# package is not installed
__version__ = None

Check warning on line 7 in widget_tweaks/__init__.py

View check run for this annotation

Codecov / codecov/patch

widget_tweaks/__init__.py#L7

Added line #L7 was not covered by tests

0 comments on commit 148bac4

Please sign in to comment.