Example #1
0
def test_signal_handlers_no_sigbreak():
    with patch('asyncio.get_event_loop') as get_event_loop:
        signal_handlers()

        loop = get_event_loop.return_value

    loop.add_signal_handler.assert_any_call(signal.SIGTERM, stop)
    loop.add_signal_handler.assert_any_call(signal.SIGINT, stop)

    assert len(loop.add_signal_handler.mock_calls) == 2
Example #2
0
def test_signal_handlers_no_sigbreak():
    with patch("asyncio.get_event_loop") as get_event_loop:
        signal_handlers()

        loop = get_event_loop.return_value

    loop.add_signal_handler.assert_any_call(signal.SIGTERM, stop)
    loop.add_signal_handler.assert_any_call(signal.SIGINT, stop)

    assert len(loop.add_signal_handler.mock_calls) == 2
Example #3
0
def test_signal_handlers_sigbreak():
    with patch('asyncio.get_event_loop') as get_event_loop:
        with patch('signal.SIGBREAK', 'foo', create=True):
            signal_handlers()

        loop = get_event_loop.return_value

    loop.add_signal_handler.assert_any_call(signal.SIGTERM, stop)
    loop.add_signal_handler.assert_any_call(signal.SIGINT, stop)
    loop.add_signal_handler.assert_any_call('foo', stop)

    assert len(loop.add_signal_handler.mock_calls) == 3
Example #4
0
def test_signal_handlers_sigbreak():
    with patch("asyncio.get_event_loop") as get_event_loop:
        with patch("signal.SIGBREAK", "foo", create=True):
            signal_handlers()

        loop = get_event_loop.return_value

    loop.add_signal_handler.assert_any_call(signal.SIGTERM, stop)
    loop.add_signal_handler.assert_any_call(signal.SIGINT, stop)
    loop.add_signal_handler.assert_any_call("foo", stop)

    assert len(loop.add_signal_handler.mock_calls) == 3