def test_atexit_hook(self):
        client = single_client(client_context.host, client_context.port)
        executor = one(client._topology._servers.values())._monitor._executor
        connected(client)

        # The executor stores a weakref to itself in _EXECUTORS.
        ref = one([r for r in _EXECUTORS.copy() if r() is executor])

        del executor
        del client

        wait_until(partial(unregistered, ref), 'unregister executor',
                   timeout=5)
    def test_atexit_hook(self):
        client = single_client(client_context.host, client_context.port)
        executor = one(client._topology._servers.values())._monitor._executor
        connected(client)

        # The executor stores a weakref to itself in _EXECUTORS.
        ref = one([r for r in _EXECUTORS.copy() if r() is executor])

        del executor
        del client

        wait_until(partial(unregistered, ref),
                   'unregister executor',
                   timeout=5)
Пример #3
0
    def test_cleanup_executors_on_client_del(self):
        client = create_client()
        executors = get_executors(client)
        self.assertEqual(len(executors), 3)

        # Each executor stores a weakref to itself in _EXECUTORS.
        executor_refs = [(r, r()._name) for r in _EXECUTORS.copy()
                         if r() in executors]

        del executors
        del client

        for ref, name in executor_refs:
            wait_until(partial(unregistered, ref),
                       'unregister executor: %s' % (name, ),
                       timeout=5)