Skip to content

Instantly share code, notes, and snippets.

@prestontimmons
Created May 8, 2012 15:53
Show Gist options
  • Save prestontimmons/2636566 to your computer and use it in GitHub Desktop.
Save prestontimmons/2636566 to your computer and use it in GitHub Desktop.
Overriding Django template loaders within tests
from django.test.utils import (
setup_test_template_loader,
restore_template_loaders,
)
class MyTest(TestCase):
def setUp(self):
setup_test_template_loader({
"basic.html": "Basic",
"headline.html": "{{ headline }}",
"has space.html": "Spaced",
"onetwo.html": "{{ first }}-{{ second }}",
})
def tearDown(self):
restore_template_loaders()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment