[FIX] tests: add flush during warmup to get correct query counts
In order to count queries exactly, the warmup phase of a test method (decorator `@warmup`) must do the exact same operations as the normal phase.
This commit is contained in:
@@ -400,6 +400,10 @@ class BaseCase(TreeCase, MetaCase('DummyCase', (object,), {})):
|
||||
msg = "Query count less than expected for user %s: %d < %d in %s at %s:%s"
|
||||
logger.info(msg, login, count, expected, funcname, filename, linenum)
|
||||
else:
|
||||
# flush before and after during warmup, in order to reproduce the
|
||||
# same operations, otherwise the caches might not be ready!
|
||||
if flush:
|
||||
self.env.user.flush()
|
||||
yield
|
||||
if flush:
|
||||
self.env.user.flush()
|
||||
|
||||
Reference in New Issue
Block a user