diff --git a/dddp/test/__init__.py b/dddp/test/__init__.py index d1fa05a..8740a3b 100644 --- a/dddp/test/__init__.py +++ b/dddp/test/__init__.py @@ -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)) diff --git a/dddp/test/django_todos/tests.py b/dddp/test/django_todos/tests.py index 7ce503c..70500dc 100644 --- a/dddp/test/django_todos/tests.py +++ b/dddp/test/django_todos/tests.py @@ -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