[tests] make sure controllers created by ctrl_publish() have a valid appli attribute
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.""""""importsysfromcubicwebimportwarningdeflines(path,comments=None):result=[]forlineinopen(path,'U'):line=line.strip()iflineand(commentsisNoneornotline.startswith(comments)):result.append(line)returnresultdefread_config(config_file):"""read the instance configuration from a file and return it as a dictionnary :type config_file: str :param config_file: path to the configuration file :rtype: dict :return: a dictionary with specified values associated to option names """config=current={}try:forlineinlines(config_file,comments='#'):try:option,value=line.split('=',1)exceptValueError:option=line.strip().lower()ifoption[0]=='[':# start a sectionsection=option[1:-1]assertnotconfig.has_key(section), \'Section %s is defined more than once'%sectionconfig[section]=current={}continueprint>>sys.stderr,'ignoring malformed line\n%r'%linecontinueoption=option.strip().replace(' ','_')value=value.strip()current[option]=valueorNoneexceptIOError,ex:warning('missing or non readable configuration file %s (%s)',config_file,ex)returnconfigdefenv_path(env_var,default,name):returndefaultdefcreate_dir(*args):raiseRuntimeError()