Exemplo n.º 1
0
Arquivo: __init__.py Projeto: l4u/fms
def get_params(args, opts):
    """
    Get params from conffile
    """
    logger = logging.getLogger('fms')
    simconffile = get_simconffile(args)
    if os.path.splitext(simconffile)[-1] == '.xml':
        logger.debug("Calling XmlParamsParser on %s" % simconffile)
        params = XmlParamsParser(simconffile)
    else:
        logger.debug("Calling YamlParamsParser on %s" % simconffile)
        params = YamlParamsParser(simconffile)
    params['simconffile'] = simconffile
    params = apply_opts(params, opts)
    params.printparams()
    return params
Exemplo n.º 2
0
Arquivo: utils.py Projeto: l4u/fms
 def testDaylengthValue(self):
     """
     Daylength is correctly read as an int
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['engines'][0]['daylength'], 10)
Exemplo n.º 3
0
Arquivo: utils.py Projeto: l4u/fms
 def testClearBooksAtEODDefaultValue(self):
     """
     Engines clear books at end of day
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertTrue(params['engines'][0]['clearbooksateod'])
Exemplo n.º 4
0
Arquivo: utils.py Projeto: l4u/fms
 def testDaylengthDefaultValue(self):
     """
     Daylength should be 1 if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['engines'][0]['daylength'], 1)
Exemplo n.º 5
0
Arquivo: utils.py Projeto: l4u/fms
 def testWorldClassValue(self):
     """
     World class is read correctly
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['world']['classname'], 'NullWorld')
Exemplo n.º 6
0
Arquivo: utils.py Projeto: l4u/fms
 def testOrdersLogFileDefaultValue(self):
     """
     OrdersLogFile shoud be None if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['orderslogfilename'], None)
Exemplo n.º 7
0
Arquivo: utils.py Projeto: l4u/fms
 def testOutputfileDefaultValue(self):
     """
     Outputfile should be sys.stdout if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['outputfilename'], 'sys.stdout')
Exemplo n.º 8
0
Arquivo: utils.py Projeto: l4u/fms
 def testRandomSeedValue(self):
     """
     Randomseed is read correctly
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['randomseed'], '12345678')
Exemplo n.º 9
0
Arquivo: utils.py Projeto: l4u/fms
 def testRandomseedDefaultValue(self):
     """
     Randomseed should be None if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['randomseed'], None)
Exemplo n.º 10
0
Arquivo: utils.py Projeto: l4u/fms
 def testExperimentNameValue(self):
     """
     Experiment name is correctly read
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['name'], 'Test Experiment')
Exemplo n.º 11
0
Arquivo: __init__.py Projeto: l4u/fms
def get_params(args, opts):
    """
    Get params from conffile
    """
    logger = logging.getLogger('fms')
    simconffile = get_simconffile(args)
    if os.path.splitext(simconffile)[-1] == '.xml':
        logger.debug("Calling XmlParamsParser on %s" % simconffile)
        params = XmlParamsParser(simconffile)
    else:
        logger.debug("Calling YamlParamsParser on %s" % simconffile)
        params = YamlParamsParser(simconffile)
    params['simconffile'] = simconffile
    params = apply_opts(params, opts)
    params.printparams()
    return params
Exemplo n.º 12
0
Arquivo: utils.py Projeto: l4u/fms
 def testMarketClassValue(self):
     """
     Market param classname is read correctly
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['engines'][0]['market']['classname'],
                      'DummyMarket')
Exemplo n.º 13
0
Arquivo: utils.py Projeto: l4u/fms
 def testEngineClassValue(self):
     """
     Engine classname is read correctly
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['engines'][0]['classname'],
                      'AsynchronousRandom')
Exemplo n.º 14
0
Arquivo: utils.py Projeto: l4u/fms
 def testOrderLogFileValue(self):
     """
     OrdersLogFile might be read from config
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['orderslogfilename'],
                      '%s/dummyoutput.log' % self.fixturesdir)
Exemplo n.º 15
0
Arquivo: utils.py Projeto: l4u/fms
 def testOuputfileValue(self):
     """
     Outputfile might be read from config
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['outputfilename'],
                      '%s/dummyoutput.csv' % self.fixturesdir)
Exemplo n.º 16
0
Arquivo: utils.py Projeto: l4u/fms
 def testExperimentNameDefaultValue(self):
     """
     Experiment name is built from filename if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['name'],
                      '%s/minimalconfig.xml experiment' % self.fixturesdir)