Esempio n. 1
0
File: __init__.py Progetto: 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
Esempio n. 2
0
File: utils.py Progetto: 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)
Esempio n. 3
0
File: utils.py Progetto: 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'])
Esempio n. 4
0
File: utils.py Progetto: 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)
Esempio n. 5
0
File: utils.py Progetto: 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')
Esempio n. 6
0
File: utils.py Progetto: 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)
Esempio n. 7
0
File: utils.py Progetto: 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')
Esempio n. 8
0
File: utils.py Progetto: l4u/fms
 def testRandomSeedValue(self):
     """
     Randomseed is read correctly
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['randomseed'], '12345678')
Esempio n. 9
0
File: utils.py Progetto: 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)
Esempio n. 10
0
File: utils.py Progetto: 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')
Esempio n. 11
0
File: __init__.py Progetto: 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
Esempio n. 12
0
File: utils.py Progetto: 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')
Esempio n. 13
0
File: utils.py Progetto: 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')
Esempio n. 14
0
File: utils.py Progetto: 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)
Esempio n. 15
0
File: utils.py Progetto: 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)
Esempio n. 16
0
File: utils.py Progetto: 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)