Created
March 13, 2018 16:54
-
-
Save jleclanche/6e3ed8d7a0ddcc255a0e0d89a928e383 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# License: CC0 | |
# https://creativecommons.org/publicdomain/zero/1.0/ | |
# https://creativecommons.org/share-your-work/public-domain/cc0/ | |
import os | |
from django.template import Template | |
def test_compile_templates(settings): | |
for template_dir in settings.TEMPLATES[0]["DIRS"]: | |
for basepath, dirs, filenames in os.walk(template_dir): | |
for filename in filenames: | |
path = os.path.join(basepath, filename) | |
with open(path, "r") as f: | |
# This will fail if the template cannot compile | |
t = Template(f.read()) | |
assert t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment