示例#1
0
def test_runner_start_and_stop():
    runner = LoaferRunner(loop=mock.Mock())
    runner.stop = mock.Mock()
    runner.start(run_forever=False)
    assert runner.loop.run_forever.called
    assert runner.stop.called
    assert runner.loop.close.called
示例#2
0
def test_runner_start_and_stop():
    runner = LoaferRunner(loop=mock.Mock())
    runner.stop = mock.Mock()
    runner.start(run_forever=False)
    assert runner.loop.run_forever.called
    assert runner.stop.called
    assert runner.loop.close.called
示例#3
0
def test_runner_start_and_stop(loop_mock):
    runner = LoaferRunner()
    runner.stop = mock.Mock()

    runner.start()

    assert runner.stop.called
    assert loop_mock.return_value.run_forever.called
    assert loop_mock.return_value.close.called
示例#4
0
def test_runner_start(loop_mock):
    runner = LoaferRunner()

    runner.start()

    assert loop_mock.return_value.run_forever.called
示例#5
0
def test_runner_start_with_debug(loop_mock):
    runner = LoaferRunner()

    runner.start(debug=True)

    loop_mock.return_value.set_debug.assert_called_once_with(enabled=True)
示例#6
0
def test_runner_start():
    runner = LoaferRunner(loop=mock.Mock())
    runner.start()
    assert runner.loop.run_forever.called
示例#7
0
def test_runner_with_cancelled_error():
    runner = LoaferRunner(loop=mock.Mock())
    runner.loop.run_forever.side_effect = CancelledError
    runner.start()
    assert runner.loop.run_forever.called
    assert runner.loop.close.called
示例#8
0
def test_runner_start_run_until_complete():
    runner = LoaferRunner(loop=mock.Mock())
    runner.stop = mock.Mock()
    runner.start(run_forever=False)
    assert runner.loop.run_until_complete.called
    assert runner.stop.called
示例#9
0
def test_runner_start_with_debug():
    loop = mock.Mock()
    runner = LoaferRunner(loop=loop)
    runner.start(debug=True)
    loop.set_debug.assert_called_once_with(enabled=True)
示例#10
0
def test_runner_start_with_debug():
    loop = mock.Mock()
    runner = LoaferRunner(loop=loop)
    runner.start(debug=True)
    assert loop.set_debug.called_once_with(enabled=True)