当前位置: 首页>>代码示例>>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;未经允许,请勿转载。