Did I find the right examples for you? yes no

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)

        def run_tests(tests_root, metadata_root, prefs_root, test_types, binary=None,
              processes=1, include=None, exclude=None, include_manifest=None,
              capture_stdio=True, product="firefox", chunk_type="none",
              total_chunks=1, this_chunk=1, timeout_multiplier=1,
              repeat=1, **kwargs):
    logging_queue = None
    loggging_thread = None
    original_stdio = (sys.stdout, sys.stderr)
    test_queues = None

    try:
        if capture_stdio:
            logging_queue = Queue()
            logging_thread = LogThread(logging_queue, logger, "info")
            sys.stdout = LoggingWrapper(logging_queue, prefix="STDOUT")
            sys.stderr = LoggingWrapper(logging_queue, prefix="STDERR")
            logging_thread.start()

        do_test_relative_imports(tests_root)

        run_info = wpttest.get_run_info(product, debug=False)

        logger.info("Using %i client processes" % processes)

        browser_cls, browser_kwargs = get_browser(product, binary, prefs_root)
        env_options = get_options(product)

        unexpected_total = 0

        if "test_loader" in kwargs:
            test_loader = kwargs["test_loader"]
        else:
            test_filter = TestFilter(include=include, exclude=exclude,
                                     manifest_path=include_manifest)
            test_loader = TestLoader(tests_root, metadata_root, test_filter, run_info)

        with TestEnvironment(tests_root, env_options) as test_environment:
            base_server = "http://%s:%i" % (test_environment.config["host"],
                                            test_environment.config["ports"]["http"][0])
            for repeat_count in xrange(repeat):
                if repeat > 1:
                    logger.info("Repetition %i / %i" % (repeat_count + 1, repeat))
                test_ids, test_queues = test_loader.queue_tests(test_types, chunk_type, total_chunks, this_chunk)
                unexpected_count = 0
                logger.suite_start(test_ids, run_info)
                for test_type in test_types:
                    tests_queue = test_queues[test_type]

                    executor_cls, executor_kwargs = get_executor(product, test_type, base_server,
                                                                 timeout_multiplier)

                    if executor_cls is None:
                        logger.error("Unsupported test type %s for product %s" % (test_type, product))
                        continue

                    with ManagerGroup("web-platform-tests",
                                      processes,
                                      browser_cls,
                                      browser_kwargs,
                                      executor_cls,
                                      executor_kwargs) as manager_group:
                        try:
                            manager_group.start(tests_queue)
                        except KeyboardInterrupt:
                            logger.critical("Main thread got signal")
                            manager_group.stop()
                            raise
                        manager_group.wait()
                    unexpected_count += manager_group.unexpected_count()

                unexpected_total += unexpected_count
                logger.info("Got %i unexpected results" % unexpected_count)
                logger.suite_end()
    except KeyboardInterrupt:
        if test_queues is not None:
            for queue in test_queues.itervalues():
                queue.cancel_join_thread()
    finally:
        if test_queues is not None:
            for queue in test_queues.itervalues():
                queue.close()
        sys.stdout, sys.stderr = original_stdio
        if capture_stdio and logging_queue is not None:
            logger.info("Closing logging queue")
            logging_queue.put(None)
            if logging_thread is not None:
                logging_thread.join(10)
            logging_queue.close()

    return manager_group.unexpected_count() == 0
        


src/w/p/wptrunner-0.2.5/wptrunner/reduce.py   wptrunner(Download)
                args["capture_stdio"] = False
                wptrunner.setup_logging(args, {})
                wptrunner.run_tests(test_loader=self.test_loader, **args)
                wptrunner.logger.remove_handler(wptrunner.logger.handlers[0])
                is_unstable = self.log_is_unstable(f)