Skip to content

Commit

Permalink
Removed deprecated DjangoTestRunner.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17840 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
aaugustin committed Mar 31, 2012
1 parent 3f16506 commit c7229c6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 41 deletions.
13 changes: 1 addition & 12 deletions django/test/simple.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,25 +10,14 @@
from django.utils.importlib import import_module from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule from django.utils.module_loading import module_has_submodule


__all__ = ('DjangoTestRunner', 'DjangoTestSuiteRunner') __all__ = ('DjangoTestSuiteRunner')


# The module name for tests outside models.py # The module name for tests outside models.py
TEST_MODULE = 'tests' TEST_MODULE = 'tests'


doctestOutputChecker = OutputChecker() doctestOutputChecker = OutputChecker()




class DjangoTestRunner(unittest.TextTestRunner):
def __init__(self, *args, **kwargs):
import warnings
warnings.warn(
"DjangoTestRunner is deprecated; it's functionality is "
"indistinguishable from TextTestRunner",
DeprecationWarning
)
super(DjangoTestRunner, self).__init__(*args, **kwargs)


def get_tests(app_module): def get_tests(app_module):
parts = app_module.__name__.split('.') parts = app_module.__name__.split('.')
prefix, last = parts[:-1], parts[-1] prefix, last = parts[:-1], parts[-1]
Expand Down
29 changes: 0 additions & 29 deletions tests/regressiontests/test_runner/tests.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,35 +24,6 @@
TEST_APP_ERROR = 'regressiontests.test_runner.invalid_app.models' TEST_APP_ERROR = 'regressiontests.test_runner.invalid_app.models'




class DjangoTestRunnerTests(unittest.TestCase):
def setUp(self):
self._warnings_state = get_warnings_state()
warnings.filterwarnings('ignore', category=DeprecationWarning,
module='django.test.simple')

def tearDown(self):
restore_warnings_state(self._warnings_state)

def test_failfast(self):
class MockTestOne(unittest.TestCase):
def runTest(self):
assert False
class MockTestTwo(unittest.TestCase):
def runTest(self):
assert False

suite = unittest.TestSuite([MockTestOne(), MockTestTwo()])
mock_stream = StringIO.StringIO()
dtr = simple.DjangoTestRunner(verbosity=0, failfast=False, stream=mock_stream)
result = dtr.run(suite)
self.assertEqual(2, result.testsRun)
self.assertEqual(2, len(result.failures))

dtr = simple.DjangoTestRunner(verbosity=0, failfast=True, stream=mock_stream)
result = dtr.run(suite)
self.assertEqual(1, result.testsRun)
self.assertEqual(1, len(result.failures))

class DependencyOrderingTests(unittest.TestCase): class DependencyOrderingTests(unittest.TestCase):


def test_simple_dependencies(self): def test_simple_dependencies(self):
Expand Down

0 comments on commit c7229c6

Please sign in to comment.