Skip to content

Commit

Permalink
Add tests to achieve 100% Test Coverage (#91)
Browse files Browse the repository at this point in the history
* create patch_settings fixture

* 100% test coverage

---------

Co-authored-by: Ben Beecher <[email protected]>
Co-authored-by: Eddy Brown <[email protected]>
Co-authored-by: Thijs Kramer <[email protected]>
Co-authored-by: Niicck <[email protected]>
  • Loading branch information
5 people authored Oct 16, 2023
1 parent 05d2121 commit 94154c7
Show file tree
Hide file tree
Showing 22 changed files with 986 additions and 193 deletions.
5 changes: 3 additions & 2 deletions django_vite/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
from django.core.checks import Warning, register

from .templatetags.django_vite import DjangoViteAssetLoader
from .exceptions import DjangoViteManifestError


class DjangoViteAppConfig(AppConfig):
name = "django_vite"
verbose_name = "Django Vite"

def ready(self) -> None:
with suppress(RuntimeError):
with suppress(DjangoViteManifestError):
# Create Loader instance at startup to prevent threading problems,
# but do not crash while doing so.
DjangoViteAssetLoader.instance()
Expand All @@ -25,7 +26,7 @@ def check_loader_instance(**kwargs):
# Make Loader instance at startup to prevent threading problems
DjangoViteAssetLoader.instance()
return []
except RuntimeError as exception:
except DjangoViteManifestError as exception:
return [
Warning(
exception,
Expand Down
10 changes: 10 additions & 0 deletions django_vite/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class DjangoViteManifestError(RuntimeError):
"""Manifest parsing failed."""

pass


class DjangoViteAssetNotFoundError(RuntimeError):
"""Vite Asset could not be found."""

pass
Loading

0 comments on commit 94154c7

Please sign in to comment.