Example #1
0
    def test_exception(self):
        q = Queue()
        for i in range(10):
            q.put(([i], {}))

        def _test_func(x):
            raise TypeError("Exception in thread %d" % x)

        with self.assertRaises(TypeError):
            exec_in_parallel(_test_func, q)
Example #2
0
    def test_exec_no_count(self):
        q = Queue()
        for i in range(10):
            q.put(([i], {}))

        res = exec_in_parallel(lambda x: x * x, q)
        self.assertSetEqual({x * x for x in range(10)}, set(res))