def test_no_locks_query_count(self):
"""Check that query count to pull in available jobs hasn't changed
If this test fails, consider changing the EXPECTED_QUERIES, or why
it regressed.
"""
EXPECTED_QUERIES = 0
# no jobs locking this object
host_ct_key = ContentType.objects.get_for_model(
self.host.downcast()).natural_key()
host_id = self.host.id
# Loads up the caches
js = JobScheduler()
reset_queries()
js.available_transitions([(host_ct_key, host_id, ), ])
query_sum = len(connection.queries)
self.assertEqual(query_sum, EXPECTED_QUERIES,
"something changed with queries! "
"got %s expected %s" % (query_sum, EXPECTED_QUERIES))
test_available_transitions.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录