def runTestCases(test_cases, options, cmd_line_options): log.debug("Running %s" % test_cases) log.debug("Options %s" % options) log.debug("cmd_line_options %s" % dict(cmd_line_options)) test_inputs = options['inputs'] oonib_reporter = OONIBReporter(cmd_line_options) yaml_reporter = YAMLReporter(cmd_line_options) if cmd_line_options['collector']: log.msg("Using remote collector, please be patient while we create the report.") try: yield oonib_reporter.createReport(options) except OONIBReportError: log.err("Error in creating new report") log.msg("We will only create reports to a file") oonib_reporter = None else: oonib_reporter = None yield yaml_reporter.createReport(options) log.msg("Reporting to file %s" % yaml_reporter._stream.name) try: input_unit_factory = InputUnitFactory(test_inputs) input_unit_factory.inputUnitSize = int(cmd_line_options['parallelism']) except Exception, e: log.exception(e)
def runTestCases(test_cases, options, cmd_line_options): log.debug("Running %s" % test_cases) log.debug("Options %s" % options) log.debug("cmd_line_options %s" % dict(cmd_line_options)) test_inputs = options['inputs'] # Set a default reporter if not cmd_line_options['collector'] and not \ cmd_line_options['no-default-reporter']: with open('collector') as f: reporter_url = random.choice(f.readlines()) reporter_url = reporter_url.split('#')[0].strip() cmd_line_options['collector'] = reporter_url oonib_reporter = OONIBReporter(cmd_line_options) yaml_reporter = YAMLReporter(cmd_line_options) if cmd_line_options['collector']: log.msg("Using remote collector, please be patient while we create the report.") try: yield oonib_reporter.createReport(options) except OONIBReportError: log.err("Error in creating new report") log.msg("We will only create reports to a file") oonib_reporter = None else: oonib_reporter = None yield yaml_reporter.createReport(options) log.msg("Reporting to file %s" % yaml_reporter._stream.name) try: input_unit_factory = InputUnitFactory(test_inputs) input_unit_factory.inputUnitSize = int(cmd_line_options['parallelism']) except Exception, e: log.exception(e)
def test_input_unit_factory(self): inputs = range(100) inputUnit = InputUnitFactory(inputs) for i in inputUnit: self.assertEqual(len(list(i)), inputUnit.inputUnitSize)
log.msg("Could not find inputs!") log.msg("options[0] = %s" % first) test_inputs = [None] log.debug("Creating %s" % yamloo_filename) if cmd_line_options['collector']: log.debug("Using remote collector %s" % cmd_line_options['collector']) oreporter = reporter.OONIBReporter(cmd_line_options['collector']) else: reportFile = open(yamloo_filename, 'w+') log.debug("Reporting to file %s" % reportFile) oreporter = reporter.YAMLReporter(reportFile) try: input_unit_factory = InputUnitFactory(test_inputs) except Exception, e: log.exception(e) log.debug("Creating report") try: yield oreporter.createReport(options) except reporter.OONIBReportCreationFailed: log.err("Error in creating new report") reactor.stop() raise except Exception, e: log.exception(e) # This deferred list is a deferred list of deferred lists