Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer committed Dec 7, 2023
1 parent e7b029e commit 1f4b116
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/test_runserver_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from aiohttp_devtools.runserver.config import Config
from aiohttp_devtools.runserver.log_handlers import fmt_size
from aiohttp_devtools.runserver.serve import (
STATIC_PATH, STATIC_URL, WS, check_port_open, cleanup_aux_app,
LAST_RELOAD, STATIC_PATH, STATIC_URL, WS, check_port_open, cleanup_aux_app,
modify_main_app, src_reload)

from .conftest import SIMPLE_APP, create_future
Expand All @@ -36,6 +36,7 @@ async def test_aux_reload(smart_caplog):
aux_app = Application()
ws = MagicMock()
ws.send_str = MagicMock(return_value=create_future())
aux_app[LAST_RELOAD] = [0, 0.]
aux_app[STATIC_PATH] = "/path/to/static_files/"
aux_app[STATIC_URL] = "/static/"
aux_app[WS] = set(((ws, "/foo/bar"),)) # type: ignore[misc]
Expand All @@ -56,6 +57,7 @@ async def test_aux_reload_no_path():
aux_app = Application()
ws = MagicMock()
ws.send_str = MagicMock(return_value=create_future())
aux_appapp[LAST_RELOAD] = [0, 0.]
aux_app[STATIC_PATH] = "/path/to/static_files/"
aux_app[STATIC_URL] = "/static/"
aux_app[WS] = set(((ws, "/foo/bar"),)) # type: ignore[misc]
Expand All @@ -74,6 +76,7 @@ async def test_aux_reload_html_different():
aux_app = Application()
ws = MagicMock()
ws.send_str = MagicMock(return_value=create_future())
aux_app[LAST_RELOAD] = [0, 0.]
aux_app[STATIC_PATH] = "/path/to/static_files/"
aux_app[STATIC_URL] = "/static/"
aux_app[WS] = set(((ws, "/foo/bar"),)) # type: ignore[misc]
Expand All @@ -86,6 +89,7 @@ async def test_aux_reload_runtime_error(smart_caplog):
ws = MagicMock()
ws.send_str = MagicMock(return_value=create_future())
ws.send_str = MagicMock(side_effect=RuntimeError('foobar'))
app[LAST_RELOAD] = [0, 0.]
aux_app[STATIC_PATH] = "/path/to/static_files/"
aux_app[STATIC_URL] = "/static/"
aux_app[WS] = set(((ws, "/foo/bar"),)) # type: ignore[misc]
Expand Down
3 changes: 2 additions & 1 deletion tests/test_runserver_watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from aiohttp import ClientSession
from aiohttp.web import Application, WebSocketResponse

from aiohttp_devtools.runserver.serve import STATIC_PATH, WS
from aiohttp_devtools.runserver.serve import LAST_RELOAD, STATIC_PATH, WS
from aiohttp_devtools.runserver.watch import AppTask, LiveReloadTask

from .conftest import create_future
Expand Down Expand Up @@ -81,6 +81,7 @@ async def test_python_no_server(event_loop, mocker):
stop_mock = mocker.patch.object(app_task, "_stop_dev_server", autospec=True)
mocker.patch.object(app_task, "_run", partial(app_task._run, live_checks=2))
app = Application()
app[LAST_RELOAD] = [0, 0.]
app[STATIC_PATH] = "/path/to/"
app.src_reload = MagicMock()
mock_ws = MagicMock()
Expand Down

0 comments on commit 1f4b116

Please sign in to comment.