mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #18551 -- Enabled skipIfDBFeature/skipUnlessDBFeature to decorate a class
Thanks Tim Graham for the review and improved patch.
This commit is contained in:
parent
a269ea4fe0
commit
6d52844b9b
3 changed files with 48 additions and 6 deletions
|
@ -1804,7 +1804,8 @@ for skipping tests.
|
|||
|
||||
.. function:: skipIfDBFeature(feature_name_string)
|
||||
|
||||
Skip the decorated test if the named database feature is supported.
|
||||
Skip the decorated test or ``TestCase`` if the named database feature is
|
||||
supported.
|
||||
|
||||
For example, the following test will not be executed if the database
|
||||
supports transactions (e.g., it would *not* run under PostgreSQL, but
|
||||
|
@ -1815,9 +1816,13 @@ it would under MySQL with MyISAM tables)::
|
|||
def test_transaction_behavior(self):
|
||||
# ... conditional test code
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
``skipIfDBFeature`` can now be used to decorate a ``TestCase`` class.
|
||||
|
||||
.. function:: skipUnlessDBFeature(feature_name_string)
|
||||
|
||||
Skip the decorated test if the named database feature is *not*
|
||||
Skip the decorated test or ``TestCase`` if the named database feature is *not*
|
||||
supported.
|
||||
|
||||
For example, the following test will only be executed if the database
|
||||
|
@ -1828,3 +1833,7 @@ under MySQL with MyISAM tables)::
|
|||
@skipUnlessDBFeature('supports_transactions')
|
||||
def test_transaction_behavior(self):
|
||||
# ... conditional test code
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
``skipUnlessDBFeature`` can now be used to decorate a ``TestCase`` class.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue