當前位置: 首頁>>代碼示例>>Python>>正文


Python test.TransactionTestCase方法代碼示例

本文整理匯總了Python中django.test.TransactionTestCase方法的典型用法代碼示例。如果您正苦於以下問題:Python test.TransactionTestCase方法的具體用法?Python test.TransactionTestCase怎麽用?Python test.TransactionTestCase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在django.test的用法示例。


在下文中一共展示了test.TransactionTestCase方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _pre_setup

# 需要導入模塊: from django import test [as 別名]
# 或者: from django.test import TransactionTestCase [as 別名]
def _pre_setup(self):
        """Disable transaction methods, and clear some globals."""
        # Repeat stuff from TransactionTestCase, because I'm not calling its
        # _pre_setup, because that would load fixtures again.
        cache.cache.clear()
        settings.TEMPLATE_DEBUG = settings.DEBUG = False


        self.client = self.client_class()
        #self._fixture_setup()
        self._urlconf_setup()
        mail.outbox = []

        # Clear site cache in case somebody's mutated Site objects and then
        # cached the mutated stuff:
        from django.contrib.sites.models import Site
        Site.objects.clear_cache() 
開發者ID:sfu-fas,項目名稱:coursys,代碼行數:19,代碼來源:testcase.py

示例2: setUp

# 需要導入模塊: from django import test [as 別名]
# 或者: from django.test import TransactionTestCase [as 別名]
def setUp(self):
        # Required to create root collection because the TransactionTestCase
        # does not make initial data loaded in migrations available and
        # serialized_rollback=True causes other problems in the test suite.
        # ref: https://docs.djangoproject.com/en/1.10/topics/testing/overview/#rollback-emulation
        Collection.objects.get_or_create(
            name="Root",
            path='0001',
            depth=1,
            numchild=0,
        )

        #: Sadly signal receivers only get connected when starting django.
        #: We will re-attach them here to mimic the django startup behavior
        #: and get the signals connected to our custom model..
        signal_handlers.register_signal_handlers() 
開發者ID:wagtail,項目名稱:wagtail,代碼行數:18,代碼來源:test_signal_handlers.py

示例3: build_suite

# 需要導入模塊: from django import test [as 別名]
# 或者: from django.test import TransactionTestCase [as 別名]
def build_suite(self, *args, **kwargs):
        """
        Check if any of the tests to run subclasses TransactionTestCase.
        """
        suite = super(NoDatabaseMixin, self).build_suite(*args, **kwargs)
        self._needs_db = any([isinstance(test, TransactionTestCase) for test in suite])
        return suite 
開發者ID:dissemin,項目名稱:dissemin,代碼行數:9,代碼來源:fasttestrunner.py

示例4: __init__

# 需要導入模塊: from django import test [as 別名]
# 或者: from django.test import TransactionTestCase [as 別名]
def __init__(self, *args, **kargs):
        super(TransactionTestCase, self).__init__(*args, **kargs)
        self.client = NetworkAPITestClient() 
開發者ID:globocom,項目名稱:GloboNetworkAPI,代碼行數:5,代碼來源:__init__.py


注:本文中的django.test.TransactionTestCase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。