tests: fallout from #447.

issue510
David Wilson 6 years ago
parent ab8d6afbae
commit 1d97493fcd

@ -791,7 +791,7 @@ class Receiver(object):
raise_channelerror = True
def __init__(self, router, handle=None, persist=True,
respondent=None, policy=None):
respondent=None, policy=None, overwrite=False):
self.router = router
#: The handle.
self.handle = handle # Avoid __repr__ crash in add_handler()
@ -802,6 +802,7 @@ class Receiver(object):
policy=policy,
persist=persist,
respondent=respondent,
overwrite=overwrite,
)
def __repr__(self):

@ -68,7 +68,8 @@ def get_or_create_pool(size=None, router=None):
_pool_lock.acquire()
try:
if _pool_pid != os.getpid():
_pool = Pool(router, [], size=size or DEFAULT_POOL_SIZE)
_pool = Pool(router, [], size=size or DEFAULT_POOL_SIZE,
overwrite=True)
_pool_pid = os.getpid()
return _pool
finally:
@ -432,12 +433,13 @@ class Pool(object):
"""
activator_class = Activator
def __init__(self, router, services, size=1):
def __init__(self, router, services, size=1, overwrite=False):
self.router = router
self._activator = self.activator_class()
self._receiver = mitogen.core.Receiver(
router=router,
handle=mitogen.core.CALL_SERVICE,
overwrite=overwrite,
)
self._select = mitogen.select.Select(oneshot=False)

@ -17,7 +17,8 @@ class NeutralizeMainTest(testlib.RouterMixin, testlib.TestCase):
klass = mitogen.master.ModuleResponder
def call(self, *args, **kwargs):
return self.klass(self.router).neutralize_main(*args, **kwargs)
router = mock.Mock()
return self.klass(router).neutralize_main(*args, **kwargs)
def test_missing_exec_guard(self):
path = testlib.data_path('main_with_no_exec_guard.py')

Loading…
Cancel
Save