Permalink
Browse files

Improved the reporting of AssertNumQueries

  • Loading branch information...
1 parent 15dc7eb commit fe9f1df610764722e5ed4a976d06e4a756714e77 Jonas Obrist committed Aug 5, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 cms/test_utils/util/context_managers.py
@@ -170,9 +170,11 @@ def __exit__(self, exc_type, exc_value, traceback):
final_queries = len(self.connection.queries)
executed = final_queries - self.starting_queries
+
+ queries = '\n'.join([q['sql'] for q in self.connection.queries[self.starting_queries:]])
self.test_case.assertEqual(
- executed, self.num, "%d queries executed, %d expected" % (
- executed, self.num
+ executed, self.num, "%d queries executed, %d expected. Queries executed:\n%s" % (
+ executed, self.num, queries
)
)

0 comments on commit fe9f1df

Please sign in to comment.