Try to use dddp.test.django_todos.tests in test suite.

This commit is contained in:
Tyson Clugg 2015-12-14 12:43:49 +11:00
parent 7bdd6baa85
commit 99fddfcc23
2 changed files with 34 additions and 3 deletions

View file

@ -13,5 +13,5 @@ def run_tests():
dddp.greenify()
django.setup()
test_runner = get_runner(settings)()
failures = test_runner.run_tests(['dddp'])
failures = test_runner.run_tests(['dddp', 'dddp.test.django_todos'])
sys.exit(bool(failures))

View file

@ -1,3 +1,34 @@
from django.test import TestCase
"""Django Todos test suite."""
# Create your tests here.
import doctest
import os
import unittest
os.environ['DJANGO_SETTINGS_MODULE'] = 'dddp.test.test_project.settings'
DOCTEST_MODULES = [
]
class NoOpTest(unittest.TestCase):
def test_noop(self):
assert True
def load_tests(loader, tests, pattern):
"""Specify which test cases to run."""
del pattern
suite = unittest.TestSuite()
# add all TestCase classes from this (current) module
for attr in globals().values():
try:
if not issubclass(attr, unittest.TestCase):
continue # not subclass of TestCase
except TypeError:
continue # not a class
tests = loader.loadTestsFromTestCase(attr)
suite.addTests(tests)
# add doctests defined in DOCTEST_MODULES
for doctest_module in DOCTEST_MODULES:
suite.addTest(doctest.DocTestSuite(doctest_module))
return suite