summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
authorPreston Timmons <prestontimmons@gmail.com>2013-04-06 12:09:44 -0500
committerCarl Meyer <carl@oddbird.net>2013-04-12 15:00:48 -0600
commit751b007c9840de9cb4e5fc622e8ea9f44e5554ca (patch)
tree4d261a319ff1ce4da17ed16cd5f55d5d8d144a81 /django/test
parentcdf520ee86e7613f29421fb2c99646ce00899b3d (diff)
Modified test_utils to work with unittest2 discovery.
Diffstat (limited to 'django/test')
-rw-r--r--django/test/simple.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/django/test/simple.py b/django/test/simple.py
index 7195d94a3a..6804b4958c 100644
--- a/django/test/simple.py
+++ b/django/test/simple.py
@@ -42,6 +42,13 @@ def get_tests(app_module):
return test_module
+def make_doctest(module):
+ return doctest.DocTestSuite(module,
+ checker=doctestOutputChecker,
+ runner=DocTestRunner,
+ )
+
+
def build_suite(app_module):
"""
Create a complete Django test suite for the provided application module.
@@ -56,9 +63,7 @@ def build_suite(app_module):
suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(
app_module))
try:
- suite.addTest(doctest.DocTestSuite(app_module,
- checker=doctestOutputChecker,
- runner=DocTestRunner))
+ suite.addTest(make_doctest(app_module))
except ValueError:
# No doc tests in models.py
pass
@@ -75,9 +80,7 @@ def build_suite(app_module):
suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(
test_module))
try:
- suite.addTest(doctest.DocTestSuite(
- test_module, checker=doctestOutputChecker,
- runner=DocTestRunner))
+ suite.addTest(make_doctest(test_module))
except ValueError:
# No doc tests in tests.py
pass
@@ -130,9 +133,7 @@ def build_test(label):
tests = []
for module in app_module, test_module:
try:
- doctests = doctest.DocTestSuite(module,
- checker=doctestOutputChecker,
- runner=DocTestRunner)
+ doctests = make_doctest(module)
# Now iterate over the suite, looking for doctests whose name
# matches the pattern that was given
for test in doctests: