test.skipIfDBFeature()

skipIfDBFeature(*feature_name_strings) [source]

Skip the decorated test or TestCase if all of the named database features are supported.

For example, the following test will not be executed if the database supports transactions (e.g., it would not run under PostgreSQL, but it would under MySQL with MyISAM tables):

class MyTests(TestCase):
    @skipIfDBFeature('supports_transactions')
    def test_transaction_behavior(self):
        # ... conditional test code
        pass
doc_Django
2016-10-09 18:40:08
Comments
Leave a Comment

Please login to continue.