Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added tet runner tests mistakenly left out of r11843. Refs #11613.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11846 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4b0f9531eb252a328d1041a5e2e4daab22b7bccc 1 parent 0fe8c20
Karen Tracey authored December 13, 2009
0  tests/regressiontests/test_runner/__init__.py
No changes.
0  tests/regressiontests/test_runner/models.py
No changes.
29  tests/regressiontests/test_runner/tests.py
... ...
@@ -0,0 +1,29 @@
  1
+"""
  2
+Tests for django test runner
  3
+"""
  4
+import StringIO
  5
+import unittest
  6
+import django
  7
+from django.test import TestCase, TransactionTestCase, simple 
  8
+
  9
+class DjangoTestRunnerTests(TestCase):
  10
+    
  11
+    def test_failfast(self):
  12
+        class MockTestOne(TransactionTestCase):
  13
+            def runTest(self):
  14
+                assert False
  15
+        class MockTestTwo(TransactionTestCase):
  16
+            def runTest(self):
  17
+                assert False
  18
+                
  19
+        suite = unittest.TestSuite([MockTestOne(), MockTestTwo()])
  20
+        mock_stream = StringIO.StringIO()
  21
+        dtr = simple.DjangoTestRunner(verbosity=0, failfast=False, stream=mock_stream)
  22
+        result = dtr.run(suite)
  23
+        self.assertEqual(2, result.testsRun)
  24
+        self.assertEqual(2, len(result.failures))
  25
+        
  26
+        dtr = simple.DjangoTestRunner(verbosity=0, failfast=True, stream=mock_stream)
  27
+        result = dtr.run(suite)
  28
+        self.assertEqual(1, result.testsRun)
  29
+        self.assertEqual(1, len(result.failures))

0 notes on commit 4b0f953

Please sign in to comment.
Something went wrong with that request. Please try again.