def test_fork(): q = mp.Queue() # this reference should keep the old http client alive in the child process # to ensure that a new one does not recycle the memory address http1 = ops._get_http_pool() parent1 = id(http1) p = mp.Process(target=_get_http_pool_id, args=(q, )) p.start() p.join() http2 = ops._get_http_pool() parent2 = id(http2) child = q.get() assert parent1 == parent2 assert child != parent1
def _get_http_pool_id(q): q.put(id(ops._get_http_pool()))