本文整理汇总了Python中django.test.signals.template_rendered.connect方法的典型用法代码示例。如果您正苦于以下问题:Python template_rendered.connect方法的具体用法?Python template_rendered.connect怎么用?Python template_rendered.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.test.signals.template_rendered
的用法示例。
在下文中一共展示了template_rendered.connect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_test_databases
# 需要导入模块: from django.test.signals import template_rendered [as 别名]
# 或者: from django.test.signals.template_rendered import connect [as 别名]
def create_test_databases(worker_id: int) -> None:
database_id = get_database_id(worker_id)
for alias in connections:
connection = connections[alias]
connection.creation.clone_test_db(
suffix=database_id,
keepdb=True,
)
settings_dict = connection.creation.get_test_db_clone_settings(database_id)
# connection.settings_dict must be updated in place for changes to be
# reflected in django.db.connections. If the following line assigned
# connection.settings_dict = settings_dict, new threads would connect
# to the default database instead of the appropriate clone.
connection.settings_dict.update(settings_dict)
connection.close()
示例2: __enter__
# 需要导入模块: from django.test.signals import template_rendered [as 别名]
# 或者: from django.test.signals.template_rendered import connect [as 别名]
def __enter__(self):
template_rendered.connect(self.on_template_render)
return self
示例3: __init__
# 需要导入模块: from django.test.signals import template_rendered [as 别名]
# 或者: from django.test.signals.template_rendered import connect [as 别名]
def __init__(self, *args: Any, **kwargs: Any) -> None:
DiscoverRunner.__init__(self, *args, **kwargs)
# `templates_rendered` holds templates which were rendered
# in proper logical tests.
self.templates_rendered: Set[str] = set()
# `shallow_tested_templates` holds templates which were rendered
# in `zerver.tests.test_templates`.
self.shallow_tested_templates: Set[str] = set()
template_rendered.connect(self.on_template_rendered)
示例4: __exit__
# 需要导入模块: from django.test.signals import template_rendered [as 别名]
# 或者: from django.test.signals.template_rendered import connect [as 别名]
def __exit__(self, exc_type, exc_value, traceback):
self.connection.use_debug_cursor = self.old_debug_cursor
request_started.connect(reset_queries)
if exc_type is not None:
return
final_queries = len(self.connection.queries)
executed = final_queries - self.starting_queries
self.test_case.assertEqual(
executed, self.num, "%d queries executed, %d expected" % (
executed, self.num
)
)
示例5: __init__
# 需要导入模块: from django.test.signals import template_rendered [as 别名]
# 或者: from django.test.signals.template_rendered import connect [as 别名]
def __init__(self, *args, **kwargs):
super(self.__class__, self).__init__(*args, **kwargs)
self.templates = []
template_rendered.connect(self._store_template_info)