Fixed #28869 -- Made tagged test classes and methods inherit tags from parents.

This commit is contained in:
Will Ayd 2017-12-01 11:00:45 -05:00 committed by Tim Graham
parent acd3baf2ae
commit 09530e61a0
6 changed files with 66 additions and 1 deletions

View file

@ -695,6 +695,7 @@ subviews
subwidget
subwidgets
superclass
superclasses
superset
swappable
symlink

View file

@ -1619,6 +1619,25 @@ You can also tag a test case::
class SampleTestCase(TestCase):
...
Subclasses inherit tags from superclasses, and methods inherit tags from their
class. Given::
@tag('foo')
class SampleTestCaseChild(SampleTestCase):
@tag('bar')
def test(self):
...
``SampleTestCaseChild.test`` will be labeled with ``'slow'``, ``'core'``,
``'bar'``, and ``'foo'``.
.. versionchanged:: 2.1
In older versions, tagged tests don't inherit tags from classes, and
tagged subclasses don't inherit tags from superclasses. For example,
``SampleTestCaseChild.test`` is labeled only with ``'bar'``.
Then you can choose which tests to run. For example, to run only fast tests:
.. code-block:: console