cubicweb #5739624 Tests with postgresql config cannot create db [validation pending]

With new API changes for running tests with PostgreSQL backend (setUpModule, tearDownModule), now tests are failing with the errors like the following:

ERROR:  template database "cache_aa86f64ac9_tmpdb___default_empty_db__" does not exist
STATEMENT:  CREATE DATABASE "tmpdb16073" TEMPLATE "cache_aa86f64ac9_tmpdb___default_empty_db__" ENCODING='UTF-8'
priorityimportant
typebug
done in3.21.2
load1.000
load left0.000
closed by#c43e5dc41f8b [devtools] add has_cache for postgres (closes #5739624), #ff7c07bbd851 [devtools] has_cache for postgres
patch[devtools] add has_cache for postgres (closes #5739624) [applied]