Exemplo n.º 1
0
 def test_event(self):
     """
     test event
     :return:
     """
     self.assertIsNone(EventsProcessor.onScriptFailure(self.config, Exception()), "should be none")
     self.assertIsNone(EventsProcessor.onScriptComplete(self.config), "should be none")
     self.assertRaisesRegexp(ConfigError, "not found", self.config.parseFromString, EVENT)
     self.config.parseFromString(EVENTLESS)
     self.assertRaisesRegexp(Exception, ".*", EventsProcessor.onScriptFailure, self.config, Exception())
     self.assertIsNone(EventsProcessor.onScriptComplete(self.config), "should be none")
     ep = EventsProcessor(self.config, BingRewardsReportItem())
     self.assertIsNotNone(ep.processReportItem(), "should not be none and be done")
Exemplo n.º 2
0
            showFullReport = True
        elif o in ("-v", "--verbose"):
            verbose = True
        elif o == "--version":
            printVersion()
            sys.exit()
        else:
            raise NotImplementedError("option '" + o + "' is not implemented")

    print "%s - script started" % helpers.getLoggingTime()
    print "-" * 80
    print

    helpers.createResultsDir(__file__)

    config = Config()

    try:
        config.parseFromFile(configFile)
    except IOError, e:
        print "IOError: %s" % e
        sys.exit(2)
    except ConfigError, e:
        print "ConfigError: %s" % e
        sys.exit(2)

    try:
        __run(config)
    except BaseException, e:
        EventsProcessor.onScriptFailure(config, e)
Exemplo n.º 3
0
            showFullReport = True
        elif o in ("-v", "--verbose"):
            verbose = True
        elif o == "--version":
            printVersion()
            sys.exit()
        else:
            raise NotImplementedError("option '" + o + "' is not implemented")

    print "%s - script started" % helpers.getLoggingTime()
    print "-" * 80
    print

    helpers.createResultsDir(__file__)

    config = Config()

    try:
        config.parseFromFile(configFile)
    except IOError, e:
        print "IOError: %s" % e
        sys.exit(2)
    except ConfigError, e:
        print "ConfigError: %s" % e
        sys.exit(2)

    try:
        __run(config)
    except BaseException, e:
        EventsProcessor.onScriptFailure(config, e)