コード例 #1
0
async def test_livereload_task_single(loop, mocker):
    mocked_awatch = mocker.patch('aiohttp_devtools.runserver.watch.awatch')
    mocked_awatch.side_effect = create_awatch_mock()

    task = LiveReloadTask('x', loop)
    task._app = MagicMock()
    await task._run()
    task._app.src_reload.assert_called_once_with('/path/to/file')
コード例 #2
0
async def test_livereload_task_multiple(loop, mocker):
    mocked_awatch = mocker.patch('aiohttp_devtools.runserver.watch.awatch')
    mocked_awatch.side_effect = create_awatch_mock({('x', '/path/to/file'), ('x', '/path/to/file2')})
    mock_src_reload = mocker.patch('aiohttp_devtools.runserver.watch.src_reload', return_value=create_future())

    task = LiveReloadTask('x', loop)
    task._app = MagicMock()
    await task._run()
    mock_src_reload.assert_called_once_with(task._app)
コード例 #3
0
async def test_livereload_task_single(loop, mocker):
    mocked_awatch = mocker.patch('aiohttp_devtools.runserver.watch.awatch')
    mocked_awatch.side_effect = create_awatch_mock()
    mock_src_reload = mocker.patch('aiohttp_devtools.runserver.watch.src_reload', return_value=create_future())

    task = LiveReloadTask('x')
    app = MagicMock()
    await task.start(app)
    await task._task
    mock_src_reload.assert_called_once_with(app, '/path/to/file')