From 3bfd760b6ede8cb57b500902ded48f6b1bcf3960 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Tue, 9 Feb 2010 21:25:44 +0100 Subject: [PATCH] Added doctests, hooked up all tests. Yay! --HG-- branch : trunk --- jinja2/testsuite/__init__.py | 4 +++- jinja2/testsuite/doctests.py | 29 +++++++++++++++++++++++++++++ jinja2/testsuite/utils.py | 5 ++++- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 jinja2/testsuite/doctests.py diff --git a/jinja2/testsuite/__init__.py b/jinja2/testsuite/__init__.py index 1032094..a222777 100644 --- a/jinja2/testsuite/__init__.py +++ b/jinja2/testsuite/__init__.py @@ -59,7 +59,7 @@ class JinjaTestCase(unittest.TestCase): def suite(): from jinja2.testsuite import ext, filters, tests, core_tags, \ loader, inheritance, imports, lexnparse, security, api, \ - regression, debug + regression, debug, utils, doctests suite = unittest.TestSuite() suite.addTest(ext.suite()) suite.addTest(filters.suite()) @@ -73,4 +73,6 @@ def suite(): suite.addTest(api.suite()) suite.addTest(regression.suite()) suite.addTest(debug.suite()) + suite.addTest(utils.suite()) + suite.addTest(doctests.suite()) return suite diff --git a/jinja2/testsuite/doctests.py b/jinja2/testsuite/doctests.py new file mode 100644 index 0000000..616d3b6 --- /dev/null +++ b/jinja2/testsuite/doctests.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +""" + jinja2.testsuite.doctests + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + The doctests. Collects all tests we want to test from + the Jinja modules. + + :copyright: (c) 2010 by the Jinja Team. + :license: BSD, see LICENSE for more details. +""" +import unittest +import doctest + + +def suite(): + from jinja2 import utils, sandbox, runtime, meta, loaders, \ + ext, environment, bccache, nodes + suite = unittest.TestSuite() + suite.addTest(doctest.DocTestSuite(utils)) + suite.addTest(doctest.DocTestSuite(sandbox)) + suite.addTest(doctest.DocTestSuite(runtime)) + suite.addTest(doctest.DocTestSuite(meta)) + suite.addTest(doctest.DocTestSuite(loaders)) + suite.addTest(doctest.DocTestSuite(ext)) + suite.addTest(doctest.DocTestSuite(environment)) + suite.addTest(doctest.DocTestSuite(bccache)) + suite.addTest(doctest.DocTestSuite(nodes)) + return suite diff --git a/jinja2/testsuite/utils.py b/jinja2/testsuite/utils.py index b18e8e6..25dde8b 100644 --- a/jinja2/testsuite/utils.py +++ b/jinja2/testsuite/utils.py @@ -9,13 +9,16 @@ :license: BSD, see LICENSE for more details. """ import os +import gc import unittest import pickle +from jinja2.testsuite import JinjaTestCase + from jinja2 import Environment, Undefined, DebugUndefined, \ StrictUndefined, UndefinedError, Template, meta -from jinja2.utils import LRUCache +from jinja2.utils import LRUCache, escape class LRUCacheTestCase(JinjaTestCase): -- 2.26.2