pytest
pytest copied to clipboard
pytest hang when run with multiprocessing
code:
import os
import multiprocessing
import gevent.monkey
gevent.monkey.patch_all()
import threading
class EventThread(threading.Thread):
def __init__(self, event=multiprocessing.Event()):
super(EventThread, self).__init__()
self.daemon = True
self.event= event
#forksafe.register(self._restart_on_fork)
def _restart_on_fork(self):
new_thread = EventThread(self.event)
new_thread.start()
def run(self):
while self.event.wait():
print("hello")
print("a")
def test_a():
pid = os.fork()
t = EventThread()
t.start()
There's probably too much here for anyone to deal with -- gevent, forks, daemon threads, multiprocessing, events, global variables...
This issue is stale because it has been open for 14 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.