コード例 #1
0
 def testPassingWithPickle(self):
     ''' Use consume_batch.py as a file that should always be there
     '''
     p = cmd.ConsumeParser('pickle')
     p.do_parse(['app_name_placeholder', 'activity', 'consume_batch.py'])
     self.assertEqual(p.csv_file, os.path.abspath('consume_batch.py'))
     self.assertEqual(p.burn_type, 'activity')
コード例 #2
0
 def testLoadingsFileDoesntExist(self):
     p = cmd.ConsumeParser()
     try:
         p.do_parse('activity', 'consume_batch.py', '-f', 'non_existent.py')
         self.assertFalse()
     except (cmd.ConsumeParserException):
         pass
     except:
         self.assertFalse
コード例 #3
0
 def testNonExistentFile(self):
     p = cmd.ConsumeParser()
     try:
         p.do_parse('activity', 'non_existent.py')
         self.assertFalse()
     except (cmd.ConsumeParserException):
         pass
     except:
         self.assertFalse
コード例 #4
0
 def testBadBurnType(self):
     p = cmd.ConsumeParser()
     try:
         p.do_parse('bogus', 'consume_batch.py')
         self.assertFalse()
     except (cmd.ConsumeParserException):
         pass
     except:
         self.assertFalse
コード例 #5
0
def main():
    try:
        can_run()
        parser = cmdline.ConsumeParser([DO_PICKLE_OUTPUT, DO_RAW_OUTPUT])
        parser.do_parse(sys.argv)
        run(parser.burn_type, parser.csv_file, parser.do_metric,
            parser.msg_level, parser.output_filename,
            parser.fuel_loadings_file, parser.col_cfg_file)
    except Exception as e:
        print(e)
コード例 #6
0
 def testPassingWithMsgLevel(self):
     ''' Use consume_batch.py as a file that should always be there
     '''
     p = cmd.ConsumeParser()
     p.do_parse([
         'app_name_placeholder', 'activity', 'consume_batch.py', '-l', '3'
     ])
     self.assertEqual(p.csv_file, os.path.abspath('consume_batch.py'))
     self.assertEqual(p.burn_type, 'activity')
     self.assertEqual(p.msg_level, 10)  # - logging.DEBUG
コード例 #7
0
ファイル: consume_batch.py プロジェクト: mkenn/FuelLoadDists
def main():
    try:
        can_run()
        parser = cmdline.ConsumeParser([DO_PICKLE_OUTPUT, DO_RAW_OUTPUT])
        parser.do_parse(sys.argv)
        run(parser.burn_type, parser.csv_file, parser.do_metric,
            parser.msg_level, parser.output_filename,
            parser.fuel_loadings_file, parser.col_cfg_file)
    except Exception as e:
        tb = sys.exc_info()[2]
        traceback.print_tb(tb, limit=-5, file=sys.stdout)
        print(e)
コード例 #8
0
 def testPassingWithLoadingsFileAndColCfgFile(self):
     ''' Use consume_batch.py as a file that should always be there
     '''
     p = cmd.ConsumeParser()
     p.do_parse([
         'app_name_placeholder', 'activity', 'consume_batch.py', '-f',
         'consume_batch.py', '-x', 'consume_batch.py'
     ])
     self.assertEqual(p.burn_type, 'activity')
     self.assertEqual(p.csv_file, os.path.abspath('consume_batch.py'))
     self.assertEqual(p.fuel_loadings_file,
                      os.path.abspath('consume_batch.py'))
     self.assertEqual(p.col_cfg_file, os.path.abspath('consume_batch.py'))
コード例 #9
0
def main():
    try:
        can_run()
        parser = cmdline.ConsumeParser([DO_PICKLE_OUTPUT, DO_RAW_OUTPUT])
        parser.do_parse(sys.argv)
        if parser.no_sera == True:
            print("no_sera is True... run without SERA emissions values")

        run(parser.burn_type, parser.csv_file, parser.do_metric,
            parser.msg_level, parser.output_filename,
            parser.fuel_loadings_file, parser.col_cfg_file, parser.no_sera)
    except Exception as e:
        tb = sys.exc_info()[2]
        traceback.print_tb(tb, limit=-5, file=sys.stdout)
        print(e)