def run(self, suites):
        wrapper = self.config.plugins.prepareTest(suites)
        if wrapper is not None:
            suites = wrapper

        wrapped = self.config.plugins.setOutputStream(self.stream)
        if wrapped is not None:
            self.stream = wrapped

        result = self._makeResult()

        _import_mp()

        result_queue = ResultQueue()
        processor = TaskProcessor(self.config.options.app_processes)
        queue_handler = ResultQueueHandler(suites, result, result_queue)

        for suite in suites:
            processor.add_task(task, args=(suite, result, result_queue))

        with measure_time(result):
            run(processor, queue_handler)

        self.config.plugins.finalize(result)

        return result
    def run(self, suites):
        wrapper = self.config.plugins.prepareTest(suites)
        if wrapper is not None:
            suites = wrapper

        wrapped = self.config.plugins.setOutputStream(self.stream)
        if wrapped is not None:
            self.stream = wrapped

        result = self._makeResult()

        _import_mp()

        result_queue = ResultQueue()
        processor = TaskProcessor(
            self.config.options.async_suites,
            self.config.options.multiprocessing_timeout,
            ResultQueueHandler(suites, result, result_queue),
        )

        for suite in suites:
            processor.add_task(task, args=(suite, result, result_queue))

        with measure_time(result):
            try:
                processor.serve()
            except KeyboardInterrupt:
                processor.destroy()
            finally:
                processor.close()

        self.config.plugins.finalize(result)

        return result
Esempio n. 3
0
    def run(self, suites):
        wrapper = self.config.plugins.prepareTest(suites)
        if wrapper is not None:
            suites = wrapper

        wrapped = self.config.plugins.setOutputStream(self.stream)
        if wrapped is not None:
            self.stream = wrapped

        result = self._makeResult()

        size = self.config.options.thread_pool
        if size < 0:
            size = cpu_count()

        pool = ThreadPool(size)

        with measure_time(result):

            for suite in suites:
                pool.apply_async(suite, args=(result,))

            pool.close()
            pool.join()

        self.config.plugins.finalize(result)
        return result
Esempio n. 4
0
    def run(self, suites):
        wrapper = self.config.plugins.prepareTest(suites)
        if wrapper is not None:
            suites = wrapper

        wrapped = self.config.plugins.setOutputStream(self.stream)
        if wrapped is not None:
            self.stream = wrapped

        result = self._makeResult()

        size = self.config.options.async_suites
        if size < 0:
            size = cpu_count()

        pool = Pool(size)

        with measure_time(result):
            for suite in suites:
                pool.spawn(suite, result)
            pool.join()

        self.config.plugins.finalize(result)

        return result