Refs #31811 -- Added optional timing outputs to the test runner.

This commit is contained in:
Ahmad A. Hussein 2020-07-22 17:37:52 +02:00 committed by Carlton Gibson
parent 21768a99f4
commit 61a0ba43cf
9 changed files with 144 additions and 38 deletions

View file

@ -14,7 +14,7 @@ from django.core.management.base import SystemCheckError
from django.test import TransactionTestCase, skipUnlessDBFeature, testcases
from django.test.runner import DiscoverRunner
from django.test.testcases import connections_support_transactions
from django.test.utils import dependency_ordered
from django.test.utils import captured_stderr, dependency_ordered
from .models import B, Person, Through
@ -148,6 +148,11 @@ class ManageCommandTests(unittest.TestCase):
with self.assertRaises(AttributeError):
call_command('test', 'sites', testrunner='test_runner.NonexistentRunner')
def test_time_recorded(self):
with captured_stderr() as stderr:
call_command('test', '--timing', 'sites', testrunner='test_runner.tests.MockTestRunner')
self.assertIn('Total run took', stderr.getvalue())
class CustomTestRunnerOptionsSettingsTests(AdminScriptTestCase):
"""