Exemplo n.º 1
0
    def test_multi_processing_handler(self):
        from multiprocessing import Process, Queue
        from logbook.queues import MultiProcessingHandler, \
             MultiProcessingSubscriber
        queue = Queue(-1)
        test_handler = logbook.TestHandler()
        subscriber = MultiProcessingSubscriber(queue)

        def send_back():
            handler = MultiProcessingHandler(queue)
            handler.push_thread()
            try:
                logbook.warn('Hello World')
            finally:
                handler.pop_thread()

        p = Process(target=send_back)
        p.start()
        p.join()

        test_handler.push_thread()
        try:
            subscriber.dispatch_once()
            self.assert_(test_handler.has_warning('Hello World'))
        finally:
            test_handler.pop_thread()
Exemplo n.º 2
0
def test_multi_processing_handler():
    from multiprocessing import Process, Queue
    from logbook.queues import MultiProcessingSubscriber
    queue = Queue(-1)
    test_handler = logbook.TestHandler()
    subscriber = MultiProcessingSubscriber(queue)

    p = Process(target=MultiProcessingHandlerSendBack(queue))
    p.start()
    p.join()

    with test_handler:
        subscriber.dispatch_once()
        assert test_handler.has_warning('Hello World')
Exemplo n.º 3
0
def test_multi_processing_handler():
    from multiprocessing import Process, Queue
    from logbook.queues import MultiProcessingSubscriber
    queue = Queue(-1)
    test_handler = logbook.TestHandler()
    subscriber = MultiProcessingSubscriber(queue)

    p = Process(target=MultiProcessingHandlerSendBack(queue))
    p.start()
    p.join()

    with test_handler:
        subscriber.dispatch_once()
        assert test_handler.has_warning('Hello World')
Exemplo n.º 4
0
def test_multi_processing_handler():
    if os.getenv('APPVEYOR') == 'True':
        pytest.skip('Test hangs on AppVeyor CI')
    from multiprocessing import Process, Queue
    from logbook.queues import MultiProcessingSubscriber
    queue = Queue(-1)
    test_handler = logbook.TestHandler()
    subscriber = MultiProcessingSubscriber(queue)

    p = Process(target=MultiProcessingHandlerSendBack(queue))
    p.start()
    p.join()

    with test_handler:
        subscriber.dispatch_once()
        assert test_handler.has_warning('Hello World')
Exemplo n.º 5
0
def test_multi_processing_handler():
    if os.getenv('APPVEYOR') == 'True':
        pytest.skip('Test hangs on AppVeyor CI')
    from multiprocessing import Process, Queue
    from logbook.queues import MultiProcessingSubscriber
    queue = Queue(-1)
    test_handler = logbook.TestHandler()
    subscriber = MultiProcessingSubscriber(queue)

    p = Process(target=MultiProcessingHandlerSendBack(queue))
    p.start()
    p.join()

    with test_handler:
        subscriber.dispatch_once()
        assert test_handler.has_warning('Hello World')