# HG changeset patch # User Julien Cristau # Date 1431959786 -7200 # Node ID f27a489994e8fb30ad0166c755b743f275abd40a # Parent 9cddd711419c55307e99d61a7fec6bc0406b9f76 [devtools] make test db name for postgresql process-specific In case we run two tests concurrently on the same cluster, better not use the same db name for both. diff -r 9cddd711419c -r f27a489994e8 devtools/__init__.py --- a/devtools/__init__.py Mon May 18 16:30:32 2015 +0200 +++ b/devtools/__init__.py Mon May 18 16:36:26 2015 +0200 @@ -585,6 +585,9 @@ return _startpgcluster(datadir) self.__CTL.add(datadir) + if 'global-db-name' not in self.system_source: + self.system_source['global-db-name'] = self.system_source['db-name'] + self.system_source['db-name'] = self.system_source['db-name'] + str(os.getpid()) @property @cached @@ -593,6 +596,10 @@ return get_db_helper('postgres') @property + def dbname(self): + return self.system_source['global-db-name'] + + @property def dbcnx(self): try: return self._cnx @@ -624,7 +631,7 @@ from cubicweb.server.serverctl import system_source_cnx, createdb # connect on the dbms system base to create our base try: - self._drop(self.dbname) + self._drop(self.system_source['db-name']) createdb(self.helper, self.system_source, self.dbcnx, self.cursor) self.dbcnx.commit() cnx = system_source_cnx(self.system_source, special_privs='LANGUAGE C', @@ -702,7 +709,7 @@ """Actual restore of the current database. Use the value tostored in db_cache as input """ - self._drop(self.dbname) + self._drop(self.system_source['db-name']) createdb(self.helper, self.system_source, self.dbcnx, self.cursor, template=backup_coordinates) self.dbcnx.commit()