mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #28869 -- Made tagged test classes and methods inherit tags from parents.
This commit is contained in:
parent
acd3baf2ae
commit
09530e61a0
6 changed files with 66 additions and 1 deletions
|
@ -695,6 +695,7 @@ subviews
|
|||
subwidget
|
||||
subwidgets
|
||||
superclass
|
||||
superclasses
|
||||
superset
|
||||
swappable
|
||||
symlink
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue