def create(file_path):
    """Create a default .sciunit config file if one does not already exist."""
    if os.path.exists(file_path):
        raise IOError("There is already a configuration file at %s" %
                      file_path)
    with open(file_path, 'w') as f:
        config = configparser.ConfigParser()
        config.add_section('misc')
        config.set('misc', 'config-version', '1.0')
        default_nb_name = os.path.split(os.path.dirname(file_path))[1]
        config.set('misc', 'nb-name', default_nb_name)
        config.add_section('root')
        config.set('root', 'path', '.')
        config.add_section('models')
        config.set('models', 'module', 'models')
        config.add_section('tests')
        config.set('tests', 'module', 'tests')
        config.add_section('suites')
        config.set('suites', 'module', 'suites')
        config.write(f)
def create ( file_path ) : if os . path . exists ( file_path ) : raise IOError ( "There is already a configuration file at %s" % file_path ) with open ( file_path , 'w' ) as f : config = configparser . ConfigParser ( ) config . add_section ( 'misc' ) config . set ( 'misc' , 'config-version' , '1.0' ) default_nb_name = os . path . split ( os . path . dirname ( file_path ) ) [ 1 ] config . set ( 'misc' , 'nb-name' , default_nb_name ) config . add_section ( 'root' ) config . set ( 'root' , 'path' , '.' ) config . add_section ( 'models' ) config . set ( 'models' , 'module' , 'models' ) config . add_section ( 'tests' ) config . set ( 'tests' , 'module' , 'tests' ) config . add_section ( 'suites' ) config . set ( 'suites' , 'module' , 'suites' ) config . write ( f )
Create a default .sciunit config file if one does not already exist.