[devtools] has_cache for postgres

authorJulien Cristau <julien.cristau@logilab.fr>
changesetff7c07bbd851
branchdefault
phasedraft
hiddenyes
parent revision#23545d4aa022 [tox] Add missing dependency on webtest for devtools tests
child revision<not specified>
files modified by this revision
devtools/__init__.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1437724628 -7200
# Fri Jul 24 09:57:08 2015 +0200
# Node ID ff7c07bbd851ea8aab839ac07c1ac605a6782067
# Parent 23545d4aa022fd419c54924f226fe95e3d7edbc8
[devtools] has_cache for postgres

diff --git a/devtools/__init__.py b/devtools/__init__.py
@@ -625,10 +625,15 @@
1          backup_name = self._backup_name(db_id)
2          if backup_name in self.helper.list_databases(self.cursor):
3              return backup_name
4          return None
5 
6 +    def has_cache(self, db_id):
7 +        backup_name = self._backup_name(db_id)
8 +        return (super(PostgresTestDataBaseHandler, self).has_cache(db_id)
9 +                and backup_name in self.helper.list_databases(self.cursor))
10 +
11      def init_test_database(self):
12          """initialize a fresh postgresql database used for testing purpose"""
13          from cubicweb.server import init_repository
14          from cubicweb.server.serverctl import system_source_cnx, createdb
15          # connect on the dbms system base to create our base