Converted recently refactored templates tests to SimpleTestCase.

These test methods don't need DB setup/teardown.

Refs #23768 and b872134b.
This commit is contained in:
Ramiro Morales 2014-12-03 17:36:17 -03:00 committed by Tim Graham
parent 2cd19f3738
commit 16f26defa7
39 changed files with 90 additions and 90 deletions

View File

@ -1,11 +1,11 @@
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.test import TestCase from django.test import SimpleTestCase
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from .utils import render, setup, SafeClass, UnsafeClass from .utils import render, setup, SafeClass, UnsafeClass
class AutoescapeTagTests(TestCase): class AutoescapeTagTests(SimpleTestCase):
@setup({'autoescape-tag01': '{% autoescape off %}hello{% endautoescape %}'}) @setup({'autoescape-tag01': '{% autoescape off %}hello{% endautoescape %}'})
def test_autoescape_tag01(self): def test_autoescape_tag01(self):

View File

@ -1,7 +1,7 @@
from django.conf import settings from django.conf import settings
from django.template.base import Context, TemplateSyntaxError from django.template.base import Context, TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup, SilentGetItemClass, SilentAttrClass, SomeClass from .utils import render, setup, SilentGetItemClass, SilentAttrClass, SomeClass
@ -13,7 +13,7 @@ basic_templates = {
} }
class BasicSyntaxTests(TestCase): class BasicSyntaxTests(SimpleTestCase):
@setup(basic_templates) @setup(basic_templates)
def test_basic_syntax01(self): def test_basic_syntax01(self):

View File

@ -1,9 +1,9 @@
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class BuiltinsTests(TestCase): class BuiltinsTests(SimpleTestCase):
@setup({'builtins01': '{{ True }}'}) @setup({'builtins01': '{{ True }}'})
def test_builtins01(self): def test_builtins01(self):

View File

@ -1,12 +1,12 @@
from django.core.cache import cache from django.core.cache import cache
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class CacheTagTests(TestCase): class CacheTagTests(SimpleTestCase):
def tearDown(self): def tearDown(self):
cache.clear() cache.clear()

View File

@ -1,9 +1,9 @@
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class CommentSyntaxTests(TestCase): class CommentSyntaxTests(SimpleTestCase):
@setup({'comment-syntax01': '{# this is hidden #}hello'}) @setup({'comment-syntax01': '{# this is hidden #}hello'})
def test_comment_syntax01(self): def test_comment_syntax01(self):

View File

@ -2,13 +2,13 @@ import warnings
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning
from .utils import render, setup from .utils import render, setup
class CycleTagTests(TestCase): class CycleTagTests(SimpleTestCase):
@setup({'cycle01': '{% cycle a %}'}) @setup({'cycle01': '{% cycle a %}'})
def test_cycle01(self): def test_cycle01(self):

View File

@ -1,13 +1,13 @@
from django.conf import settings from django.conf import settings
from django.template.base import TemplateDoesNotExist, TemplateSyntaxError from django.template.base import TemplateDoesNotExist, TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .test_extends import inheritance_templates from .test_extends import inheritance_templates
from .utils import render, setup from .utils import render, setup
class ExceptionsTests(TestCase): class ExceptionsTests(SimpleTestCase):
@setup({'exception01': "{% extends 'nonexistent' %}"}) @setup({'exception01': "{% extends 'nonexistent' %}"})
def test_exception01(self): def test_exception01(self):

View File

@ -1,5 +1,5 @@
from django.template.base import Template from django.template.base import Template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
@ -57,7 +57,7 @@ inheritance_templates = {
} }
class InheritanceTests(TestCase): class InheritanceTests(SimpleTestCase):
@setup(inheritance_templates) @setup(inheritance_templates)
def test_inheritance01(self): def test_inheritance01(self):

View File

@ -5,13 +5,13 @@ import warnings
from django.conf import settings from django.conf import settings
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning
from .utils import render, setup, SomeClass, SomeOtherException, UTF8Class from .utils import render, setup, SomeClass, SomeOtherException, UTF8Class
class FilterSyntaxTests(TestCase): class FilterSyntaxTests(SimpleTestCase):
@setup({'filter-syntax01': '{{ var|upper }}'}) @setup({'filter-syntax01': '{{ var|upper }}'})
def test_filter_syntax01(self): def test_filter_syntax01(self):

View File

@ -1,11 +1,11 @@
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class FilterTagTests(TestCase): class FilterTagTests(SimpleTestCase):
@setup({'filter01': '{% filter upper %}{% endfilter %}'}) @setup({'filter01': '{% filter upper %}{% endfilter %}'})
def test_filter01(self): def test_filter01(self):

View File

@ -2,13 +2,13 @@ import warnings
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning
from .utils import render, setup from .utils import render, setup
class FirstOfTagTests(TestCase): class FirstOfTagTests(SimpleTestCase):
@setup({'firstof01': '{% firstof a b c %}'}) @setup({'firstof01': '{% firstof a b c %}'})
def test_firstof01(self): def test_firstof01(self):

View File

@ -2,13 +2,13 @@ import warnings
from django.conf import settings from django.conf import settings
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.test import TestCase from django.test import SimpleTestCase
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning
from .utils import render, setup from .utils import render, setup
class ForTagTests(TestCase): class ForTagTests(SimpleTestCase):
@setup({'for-tag01': '{% for val in values %}{{ val }}{% endfor %}'}) @setup({'for-tag01': '{% for val in values %}{{ val }}{% endfor %}'})
def test_for_tag01(self): def test_for_tag01(self):

View File

@ -2,13 +2,13 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import SimpleTestCase
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from .utils import render, setup from .utils import render, setup
class I18nTagTests(TestCase): class I18nTagTests(SimpleTestCase):
@setup({'i18n01': '{% load i18n %}{% trans \'xxxyyyxxx\' %}'}) @setup({'i18n01': '{% load i18n %}{% trans \'xxxyyyxxx\' %}'})
def test_i18n01(self): def test_i18n01(self):

View File

@ -1,11 +1,11 @@
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup, TestObj from .utils import render, setup, TestObj
class IfTagTests(TestCase): class IfTagTests(SimpleTestCase):
@setup({'if-tag01': '{% if foo %}yes{% else %}no{% endif %}'}) @setup({'if-tag01': '{% if foo %}yes{% else %}no{% endif %}'})
def test_if_tag01(self): def test_if_tag01(self):

View File

@ -1,9 +1,9 @@
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class IfChangedTagTests(TestCase): class IfChangedTagTests(SimpleTestCase):
@setup({'ifchanged01': '{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}'}) @setup({'ifchanged01': '{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}'})
def test_ifchanged01(self): def test_ifchanged01(self):

View File

@ -1,9 +1,9 @@
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class IfEqualTagTests(TestCase): class IfEqualTagTests(SimpleTestCase):
@setup({'ifequal01': '{% ifequal a b %}yes{% endifequal %}'}) @setup({'ifequal01': '{% ifequal a b %}yes{% endifequal %}'})
def test_ifequal01(self): def test_ifequal01(self):
@ -194,7 +194,7 @@ class IfEqualTagTests(TestCase):
self.assertEqual(output, 'x') self.assertEqual(output, 'x')
class IfNotEqualTagTests(TestCase): class IfNotEqualTagTests(SimpleTestCase):
@setup({'ifnotequal01': '{% ifnotequal a b %}yes{% endifnotequal %}'}) @setup({'ifnotequal01': '{% ifnotequal a b %}yes{% endifnotequal %}'})
def test_ifnotequal01(self): def test_ifnotequal01(self):

View File

@ -1,7 +1,7 @@
from django.conf import settings from django.conf import settings
from django.template.base import Context, TemplateDoesNotExist, TemplateSyntaxError from django.template.base import Context, TemplateDoesNotExist, TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .test_basic import basic_templates from .test_basic import basic_templates
from .utils import render, setup from .utils import render, setup
@ -13,7 +13,7 @@ include_fail_templates = {
} }
class IncludeTagTests(TestCase): class IncludeTagTests(SimpleTestCase):
@setup({'include01': '{% include "basic-syntax01" %}'}, basic_templates) @setup({'include01': '{% include "basic-syntax01" %}'}, basic_templates)
def test_include01(self): def test_include01(self):

View File

@ -1,10 +1,10 @@
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class InvalidStringTests(TestCase): class InvalidStringTests(SimpleTestCase):
@setup({'invalidstr01': '{{ var|default:"Foo" }}'}) @setup({'invalidstr01': '{{ var|default:"Foo" }}'})
def test_invalidstr01(self): def test_invalidstr01(self):

View File

@ -1,10 +1,10 @@
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class ListIndexTests(TestCase): class ListIndexTests(SimpleTestCase):
@setup({'list-index01': '{{ var.1 }}'}) @setup({'list-index01': '{{ var.1 }}'})
def test_list_index01(self): def test_list_index01(self):

View File

@ -1,11 +1,11 @@
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class LoadTagTests(TestCase): class LoadTagTests(SimpleTestCase):
@setup({'load01': '{% load testtags subpackage.echo %}{% echo test %} {% echo2 "test" %}'}) @setup({'load01': '{% load testtags subpackage.echo %}{% echo test %} {% echo2 "test" %}'})
def test_load01(self): def test_load01(self):

View File

@ -1,9 +1,9 @@
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class LoremTagTests(TestCase): class LoremTagTests(SimpleTestCase):
@setup({'lorem1': '{% lorem 3 w %}'}) @setup({'lorem1': '{% lorem 3 w %}'})
def test_lorem1(self): def test_lorem1(self):

View File

@ -1,4 +1,4 @@
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
@ -13,7 +13,7 @@ gentlemen.
""" """
class MultilineTests(TestCase): class MultilineTests(SimpleTestCase):
@setup({'multiline01': multiline_string}) @setup({'multiline01': multiline_string})
def test_multiline01(self): def test_multiline01(self):

View File

@ -1,11 +1,11 @@
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class NamedEndblockTests(TestCase): class NamedEndblockTests(SimpleTestCase):
@setup({'namedendblocks01': '1{% block first %}_{% block second %}' @setup({'namedendblocks01': '1{% block first %}_{% block second %}'
'2{% endblock second %}_{% endblock first %}3'}) '2{% endblock second %}_{% endblock first %}3'})

View File

@ -1,12 +1,12 @@
from datetime import datetime from datetime import datetime
from django.test import TestCase from django.test import SimpleTestCase
from django.utils.formats import date_format from django.utils.formats import date_format
from .utils import render, setup from .utils import render, setup
class NowTagTests(TestCase): class NowTagTests(SimpleTestCase):
@setup({'now01': '{% now "j n Y" %}'}) @setup({'now01': '{% now "j n Y" %}'})
def test_now01(self): def test_now01(self):

View File

@ -1,7 +1,7 @@
from unittest import skipIf from unittest import skipIf
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
@ -12,7 +12,7 @@ except ImportError:
@skipIf(numpy is False, "Numpy must be installed to run these tests.") @skipIf(numpy is False, "Numpy must be installed to run these tests.")
class NumpyTests(TestCase): class NumpyTests(SimpleTestCase):
@setup({'numpy-array-index01': '{{ var.1 }}'}) @setup({'numpy-array-index01': '{{ var.1 }}'})
def test_numpy_array_index01(self): def test_numpy_array_index01(self):

View File

@ -2,12 +2,12 @@ from datetime import date
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class RegroupTagTests(TestCase): class RegroupTagTests(SimpleTestCase):
@setup({'regroup01': '' @setup({'regroup01': ''
'{% regroup data by bar as grouped %}' '{% regroup data by bar as grouped %}'

View File

@ -1,10 +1,10 @@
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import SimpleTestCase
from .utils import setup from .utils import setup
class SetupTests(TestCase): class SetupTests(SimpleTestCase):
def test_setup(self): def test_setup(self):
""" """

View File

@ -1,11 +1,11 @@
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class SimpleTagTests(TestCase): class SimpleTagTests(SimpleTestCase):
@setup({'simpletag-renamed01': '{% load custom %}{% minusone 7 %}'}) @setup({'simpletag-renamed01': '{% load custom %}{% minusone 7 %}'})
def test_simpletag_renamed01(self): def test_simpletag_renamed01(self):

View File

@ -1,9 +1,9 @@
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class SpacelessTagTests(TestCase): class SpacelessTagTests(SimpleTestCase):
@setup({'spaceless01': "{% spaceless %} <b> <i> text </i> </b> {% endspaceless %}"}) @setup({'spaceless01': "{% spaceless %} <b> <i> text </i> </b> {% endspaceless %}"})
def test_spaceless01(self): def test_spaceless01(self):

View File

@ -1,7 +1,7 @@
import os import os
import warnings import warnings
from django.test import override_settings, TestCase from django.test import override_settings, SimpleTestCase
from django.utils._os import upath from django.utils._os import upath
from django.utils.deprecation import RemovedInDjango19Warning from django.utils.deprecation import RemovedInDjango19Warning
@ -13,7 +13,7 @@ root = os.path.abspath(os.path.join(cwd, ".."))
@override_settings(ALLOWED_INCLUDE_ROOTS=(root)) @override_settings(ALLOWED_INCLUDE_ROOTS=(root))
class SsiTagTests(TestCase): class SsiTagTests(SimpleTestCase):
# Test normal behavior # Test normal behavior
@setup({'ssi01': '{%% ssi "%s" %%}' % os.path.join( @setup({'ssi01': '{%% ssi "%s" %%}' % os.path.join(

View File

@ -1,12 +1,12 @@
from django.conf import settings from django.conf import settings
from django.test import override_settings, TestCase from django.test import override_settings, SimpleTestCase
from django.utils.six.moves.urllib.parse import urljoin from django.utils.six.moves.urllib.parse import urljoin
from .utils import render, setup from .utils import render, setup
@override_settings(MEDIA_URL="/media/", STATIC_URL="/static/") @override_settings(MEDIA_URL="/media/", STATIC_URL="/static/")
class StaticTagTests(TestCase): class StaticTagTests(SimpleTestCase):
@setup({'static-prefixtag01': '{% load static %}{% get_static_prefix %}'}) @setup({'static-prefixtag01': '{% load static %}{% get_static_prefix %}'})
def test_static_prefixtag01(self): def test_static_prefixtag01(self):

View File

@ -1,11 +1,11 @@
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class TemplateTagTests(TestCase): class TemplateTagTests(SimpleTestCase):
@setup({'templatetag01': '{% templatetag openblock %}'}) @setup({'templatetag01': '{% templatetag openblock %}'})
def test_templatetag01(self): def test_templatetag01(self):

View File

@ -4,14 +4,14 @@ import warnings
from django.core.urlresolvers import NoReverseMatch from django.core.urlresolvers import NoReverseMatch
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import override_settings, TestCase from django.test import override_settings, SimpleTestCase
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning
from .utils import render, setup from .utils import render, setup
@override_settings(ROOT_URLCONF='template_tests.urls') @override_settings(ROOT_URLCONF='template_tests.urls')
class UrlTagTests(TestCase): class UrlTagTests(SimpleTestCase):
# Successes # Successes
@setup({'url01': '{% url "template_tests.views.client" client.id %}'}) @setup({'url01': '{% url "template_tests.views.client" client.id %}'})

View File

@ -1,11 +1,11 @@
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class VerbatimTagTests(TestCase): class VerbatimTagTests(SimpleTestCase):
@setup({'verbatim-tag01': '{% verbatim %}{{bare }}{% endverbatim %}'}) @setup({'verbatim-tag01': '{% verbatim %}{{bare }}{% endverbatim %}'})
def test_verbatim_tag01(self): def test_verbatim_tag01(self):

View File

@ -1,12 +1,12 @@
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.template.loader import get_template from django.template.loader import get_template
from django.test import TestCase from django.test import SimpleTestCase
from django.utils import six from django.utils import six
from .utils import render, setup from .utils import render, setup
class WidthRatioTagTests(TestCase): class WidthRatioTagTests(SimpleTestCase):
@setup({'widthratio01': '{% widthratio a b 0 %}'}) @setup({'widthratio01': '{% widthratio a b 0 %}'})
def test_widthratio01(self): def test_widthratio01(self):

View File

@ -1,11 +1,11 @@
from django.conf import settings from django.conf import settings
from django.template.base import TemplateSyntaxError from django.template.base import TemplateSyntaxError
from django.test import TestCase from django.test import SimpleTestCase
from .utils import render, setup from .utils import render, setup
class WithTagTests(TestCase): class WithTagTests(SimpleTestCase):
@setup({'with01': '{% with key=dict.key %}{{ key }}{% endwith %}'}) @setup({'with01': '{% with key=dict.key %}{{ key }}{% endwith %}'})
def test_with01(self): def test_with01(self):

View File

@ -24,7 +24,7 @@ from django.template import TemplateDoesNotExist, Context
from django.template.loaders.eggs import Loader as EggLoader from django.template.loaders.eggs import Loader as EggLoader
from django.template.engine import Engine from django.template.engine import Engine
from django.template import loader from django.template import loader
from django.test import TestCase, override_settings from django.test import SimpleTestCase, override_settings
from django.test.utils import IgnorePendingDeprecationWarningsMixin from django.test.utils import IgnorePendingDeprecationWarningsMixin
from django.utils import six from django.utils import six
from django.utils._os import upath from django.utils._os import upath
@ -52,7 +52,7 @@ def create_egg(name, resources):
@unittest.skipUnless(pkg_resources, 'setuptools is not installed') @unittest.skipUnless(pkg_resources, 'setuptools is not installed')
class EggLoaderTest(TestCase): class EggLoaderTest(SimpleTestCase):
def setUp(self): def setUp(self):
# Defined here b/c at module scope we may not have pkg_resources # Defined here b/c at module scope we may not have pkg_resources
class MockProvider(pkg_resources.NullProvider): class MockProvider(pkg_resources.NullProvider):
@ -116,7 +116,7 @@ class EggLoaderTest(TestCase):
)), )),
) )
) )
class CachedLoader(TestCase): class CachedLoader(SimpleTestCase):
def test_templatedir_caching(self): def test_templatedir_caching(self):
"Check that the template directories form part of the template cache key. Refs #13573" "Check that the template directories form part of the template cache key. Refs #13573"
# Retrieve a template specifying a template directory to check # Retrieve a template specifying a template directory to check
@ -148,7 +148,7 @@ class CachedLoader(TestCase):
os.path.join(os.path.dirname(upath(__file__)), 'templates'), os.path.join(os.path.dirname(upath(__file__)), 'templates'),
) )
) )
class RenderToStringTest(TestCase): class RenderToStringTest(SimpleTestCase):
def test_basic(self): def test_basic(self):
self.assertEqual(loader.render_to_string('test_context.html'), 'obj:\n') self.assertEqual(loader.render_to_string('test_context.html'), 'obj:\n')
@ -215,7 +215,7 @@ class TemplateDirsOverrideTest(IgnorePendingDeprecationWarningsMixin, unittest.T
)), )),
) )
) )
class PriorityCacheLoader(TestCase): class PriorityCacheLoader(SimpleTestCase):
def test_basic(self): def test_basic(self):
""" """
Check that the order of template loader works. Refs #21460. Check that the order of template loader works. Refs #21460.
@ -228,7 +228,7 @@ class PriorityCacheLoader(TestCase):
TEMPLATE_LOADERS=('django.template.loaders.filesystem.Loader', TEMPLATE_LOADERS=('django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',), 'django.template.loaders.app_directories.Loader',),
) )
class PriorityLoader(TestCase): class PriorityLoader(SimpleTestCase):
def test_basic(self): def test_basic(self):
""" """
Check that the order of template loader works. Refs #21460. Check that the order of template loader works. Refs #21460.

View File

@ -5,7 +5,7 @@ import pickle
import time import time
from datetime import datetime from datetime import datetime
from django.test import RequestFactory, TestCase from django.test import RequestFactory, SimpleTestCase
from django.conf import settings from django.conf import settings
from django.template import Template, Context from django.template import Template, Context
from django.template.response import (TemplateResponse, SimpleTemplateResponse, from django.template.response import (TemplateResponse, SimpleTemplateResponse,
@ -25,7 +25,7 @@ class CustomURLConfMiddleware(object):
request.urlconf = 'template_tests.alternate_urls' request.urlconf = 'template_tests.alternate_urls'
class SimpleTemplateResponseTest(TestCase): class SimpleTemplateResponseTest(SimpleTestCase):
def _response(self, template='foo', *args, **kwargs): def _response(self, template='foo', *args, **kwargs):
return SimpleTemplateResponse(Template(template), *args, **kwargs) return SimpleTemplateResponse(Template(template), *args, **kwargs)
@ -210,7 +210,7 @@ class SimpleTemplateResponseTest(TestCase):
TEMPLATE_CONTEXT_PROCESSORS=[test_processor_name], TEMPLATE_CONTEXT_PROCESSORS=[test_processor_name],
TEMPLATE_DIRS=(os.path.join(os.path.dirname(upath(__file__)), 'templates')), TEMPLATE_DIRS=(os.path.join(os.path.dirname(upath(__file__)), 'templates')),
) )
class TemplateResponseTest(TestCase): class TemplateResponseTest(SimpleTestCase):
def setUp(self): def setUp(self):
self.factory = RequestFactory() self.factory = RequestFactory()
@ -311,7 +311,7 @@ class TemplateResponseTest(TestCase):
], ],
ROOT_URLCONF='template_tests.urls', ROOT_URLCONF='template_tests.urls',
) )
class CustomURLConfTest(TestCase): class CustomURLConfTest(SimpleTestCase):
def test_custom_urlconf(self): def test_custom_urlconf(self):
response = self.client.get('/template_response_view/') response = self.client.get('/template_response_view/')
@ -327,7 +327,7 @@ class CustomURLConfTest(TestCase):
], ],
ROOT_URLCONF='template_tests.alternate_urls', ROOT_URLCONF='template_tests.alternate_urls',
) )
class CacheMiddlewareTest(TestCase): class CacheMiddlewareTest(SimpleTestCase):
def test_middleware_caching(self): def test_middleware_caching(self):
response = self.client.get('/template_response_view/') response = self.client.get('/template_response_view/')

View File

@ -13,7 +13,7 @@ from django.core import urlresolvers
from django.template import loader, Context, RequestContext, Template, TemplateSyntaxError from django.template import loader, Context, RequestContext, Template, TemplateSyntaxError
from django.template.engine import Engine from django.template.engine import Engine
from django.template.loaders import app_directories, filesystem from django.template.loaders import app_directories, filesystem
from django.test import RequestFactory, TestCase from django.test import RequestFactory, SimpleTestCase
from django.test.utils import override_settings, extend_sys_path from django.test.utils import override_settings, extend_sys_path
from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning
from django.utils._os import upath from django.utils._os import upath
@ -28,7 +28,7 @@ class ContextStackException(Exception):
pass pass
class TemplateLoaderTests(TestCase): class TemplateLoaderTests(SimpleTestCase):
def test_loaders_security(self): def test_loaders_security(self):
ad_loader = app_directories.Loader(Engine.get_default()) ad_loader = app_directories.Loader(Engine.get_default())
@ -253,7 +253,7 @@ class TemplateLoaderTests(TestCase):
) )
class TemplateRegressionTests(TestCase): class TemplateRegressionTests(SimpleTestCase):
def test_token_smart_split(self): def test_token_smart_split(self):
# Regression test for #7027 # Regression test for #7027
@ -395,7 +395,7 @@ class TemplateRegressionTests(TestCase):
# Set ALLOWED_INCLUDE_ROOTS so that ssi works. # Set ALLOWED_INCLUDE_ROOTS so that ssi works.
@override_settings(TEMPLATE_DEBUG=False, ROOT_URLCONF='template_tests.urls') @override_settings(TEMPLATE_DEBUG=False, ROOT_URLCONF='template_tests.urls')
class TemplateTests(TestCase): class TemplateTests(SimpleTestCase):
@register_test_tags @register_test_tags
def test_templates(self): def test_templates(self):
@ -501,7 +501,7 @@ class TemplateTests(TestCase):
return output return output
class TemplateTagLoading(TestCase): class TemplateTagLoading(SimpleTestCase):
def setUp(self): def setUp(self):
self.egg_dir = '%s/eggs' % os.path.dirname(upath(__file__)) self.egg_dir = '%s/eggs' % os.path.dirname(upath(__file__))
@ -585,7 +585,7 @@ class RequestContextTests(unittest.TestCase):
) )
class SSITests(TestCase): class SSITests(SimpleTestCase):
def setUp(self): def setUp(self):
self.this_dir = os.path.dirname(os.path.abspath(upath(__file__))) self.this_dir = os.path.dirname(os.path.abspath(upath(__file__)))
self.ssi_dir = os.path.join(self.this_dir, "templates", "first") self.ssi_dir = os.path.join(self.this_dir, "templates", "first")