2013-07-01 12:22:27 +00:00
|
|
|
import unittest
|
|
|
|
|
2013-12-11 22:31:34 +00:00
|
|
|
from django.apps import app_cache
|
2013-07-01 19:49:11 +00:00
|
|
|
from django.test.utils import IgnoreAllDeprecationWarningsMixin
|
2013-04-12 21:04:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
def suite():
|
|
|
|
testSuite = unittest.TestSuite()
|
|
|
|
testSuite.addTest(SuiteOverrideTest('test_suite_override'))
|
|
|
|
return testSuite
|
|
|
|
|
|
|
|
|
2013-07-01 19:49:11 +00:00
|
|
|
class SuiteOverrideTest(IgnoreAllDeprecationWarningsMixin, unittest.TestCase):
|
|
|
|
|
2013-04-12 21:04:40 +00:00
|
|
|
def test_suite_override(self):
|
|
|
|
"""
|
|
|
|
Validate that you can define a custom suite when running tests with
|
|
|
|
``django.test.simple.DjangoTestSuiteRunner`` (which builds up a test
|
|
|
|
suite using ``build_suite``).
|
|
|
|
"""
|
|
|
|
|
2013-06-14 14:02:30 +00:00
|
|
|
from django.test.simple import build_suite
|
2013-12-14 19:36:22 +00:00
|
|
|
app_config = app_cache.get_app_config("test_suite_override")
|
|
|
|
suite = build_suite(app_config)
|
2013-04-12 21:04:40 +00:00
|
|
|
self.assertEqual(suite.countTestCases(), 1)
|
|
|
|
|
|
|
|
|
|
|
|
class SampleTests(unittest.TestCase):
|
|
|
|
"""These tests should not be discovered, due to the custom suite."""
|
|
|
|
def test_one(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def test_two(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def test_three(self):
|
|
|
|
pass
|