-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't fail Python tests for missing SVG icons
We don't want to have to run the frontend build to run Python tests.
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import re | ||
|
||
from django.template.base import Origin | ||
from django.template.loaders.base import Loader | ||
|
||
|
||
SVG_FILENAME = re.compile(r"^.*\.svg$") | ||
|
||
|
||
class IgnoreMissingSVGsTemplateLoader(Loader): | ||
def get_template_sources(self, template_name): | ||
if SVG_FILENAME.match(template_name): # pragma: no branch | ||
yield Origin(template_name, template_name, loader=self) | ||
|
||
def get_contents(self, origin): | ||
return "" |