def test_workers_die_when_main_process_dies(self):
        """ Tests that when the main processes dies, the process workers will kill themselves """
        manager = Manager()
        return_list = manager.list()

        def run_process_pool(return_list):
            pool = ProcessPool(1)
            pool.start(WorkerIdGeneratingWorker)
            return_list.append(pool._workers[0].pid)
            # We dont call pool.stop() and hence leave workers alive

        process = Process(target=run_process_pool, args=(return_list,))
        process.start()
        process.join()
        # The worker has now started

        worker_pid = return_list[0]

        for _ in range(20):
            worker_is_alive = pid_exists(worker_pid)
            if not worker_is_alive:
                break
            time.sleep(0.1)
        self.assertFalse(worker_is_alive)
 Tests that when the main processes dies, the process workers will kill themselves 
petastorm/workers_pool/tests/test_workers_pool.py