mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #29106 -- Made DiscoverRunner display selected test tags.
This commit is contained in:
parent
cb7860cced
commit
5a669ae2f4
2 changed files with 18 additions and 0 deletions
|
@ -5,6 +5,7 @@ from unittest import TestSuite, TextTestRunner, defaultTestLoader
|
|||
|
||||
from django.test import TestCase
|
||||
from django.test.runner import DiscoverRunner
|
||||
from django.test.utils import captured_stdout
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
@ -210,3 +211,15 @@ class DiscoverRunnerTest(TestCase):
|
|||
self.assertEqual(count_tests(tags=['foo'], exclude_tags=['bar']), 2)
|
||||
self.assertEqual(count_tests(tags=['foo'], exclude_tags=['bar', 'baz']), 1)
|
||||
self.assertEqual(count_tests(exclude_tags=['foo']), 0)
|
||||
|
||||
def test_included_tags_displayed(self):
|
||||
runner = DiscoverRunner(tags=['foo', 'bar'], verbosity=2)
|
||||
with captured_stdout() as stdout:
|
||||
runner.build_suite(['test_runner_apps.tagged.tests'])
|
||||
self.assertIn('Including test tag(s): bar, foo.\n', stdout.getvalue())
|
||||
|
||||
def test_excluded_tags_displayed(self):
|
||||
runner = DiscoverRunner(exclude_tags=['foo', 'bar'], verbosity=3)
|
||||
with captured_stdout() as stdout:
|
||||
runner.build_suite(['test_runner_apps.tagged.tests'])
|
||||
self.assertIn('Excluding test tag(s): bar, foo.\n', stdout.getvalue())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue