Fix SignalMixin

This commit is contained in:
Jean-Paul Calderone 2019-03-07 18:25:16 -05:00
parent 3814ccb947
commit e26895b149

View File

@ -120,7 +120,7 @@ class NonASCIIPathMixin:
return unicode_name return unicode_name
class SignalMixin: class SignalMixin(object):
# This class is necessary for any code which wants to use Processes # This class is necessary for any code which wants to use Processes
# outside the usual reactor.run() environment. It is copied from # outside the usual reactor.run() environment. It is copied from
# Twisted's twisted.test.test_process . Note that Twisted-8.2.0 uses # Twisted's twisted.test.test_process . Note that Twisted-8.2.0 uses
@ -134,10 +134,12 @@ class SignalMixin:
if hasattr(reactor, "_handleSigchld") and hasattr(signal, "SIGCHLD"): if hasattr(reactor, "_handleSigchld") and hasattr(signal, "SIGCHLD"):
self.sigchldHandler = signal.signal(signal.SIGCHLD, self.sigchldHandler = signal.signal(signal.SIGCHLD,
reactor._handleSigchld) reactor._handleSigchld)
return super(SignalMixin, self).setUp()
def tearDown(self): def tearDown(self):
if self.sigchldHandler: if self.sigchldHandler:
signal.signal(signal.SIGCHLD, self.sigchldHandler) signal.signal(signal.SIGCHLD, self.sigchldHandler)
return super(SignalMixin, self).tearDown()
class StallMixin: class StallMixin:
def stall(self, res=None, delay=1): def stall(self, res=None, delay=1):