Negligible formatting changes to tests/regressiontests/templates/loaders.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
fbef599f60
commit
345a096756
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Test cases for the template loaders
|
||||
|
||||
Note: This test requires setuptools!
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -17,7 +18,7 @@ import StringIO
|
|||
from django.template import TemplateDoesNotExist
|
||||
from django.template.loaders.eggs import load_template_source as lts_egg
|
||||
|
||||
#Mock classes and objects for pkg_resources functions
|
||||
# Mock classes and objects for pkg_resources functions.
|
||||
class MockProvider(pkg_resources.NullProvider):
|
||||
def __init__(self, module):
|
||||
pkg_resources.NullProvider.__init__(self, module)
|
||||
|
@ -35,13 +36,14 @@ class MockProvider(pkg_resources.NullProvider):
|
|||
def _get(self, path):
|
||||
return self.module._resources[path].read()
|
||||
|
||||
class MockLoader(object): pass
|
||||
class MockLoader(object):
|
||||
pass
|
||||
|
||||
def create_egg(name, resources):
|
||||
"""
|
||||
Creates a mock egg with a list of resources
|
||||
Creates a mock egg with a list of resources.
|
||||
|
||||
name: The name of the module
|
||||
name: The name of the module.
|
||||
resources: A dictionary of resources. Keys are the names and values the the data.
|
||||
"""
|
||||
egg = imp.new_module(name)
|
||||
|
@ -49,7 +51,6 @@ def create_egg(name, resources):
|
|||
egg._resources = resources
|
||||
sys.modules[name] = egg
|
||||
|
||||
|
||||
class EggLoader(unittest.TestCase):
|
||||
def setUp(self):
|
||||
pkg_resources._provider_factories[MockLoader] = MockProvider
|
||||
|
@ -87,6 +88,5 @@ class EggLoader(unittest.TestCase):
|
|||
settings.INSTALLED_APPS = []
|
||||
self.assertRaises(TemplateDoesNotExist, lts_egg, "y.html")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue