Skip to content

Commit 9369aab

Browse files
committed
Fix all references to idom.server
1 parent 4d66d50 commit 9369aab

File tree

12 files changed

+31
-37
lines changed

12 files changed

+31
-37
lines changed

src/idom/backend/fastapi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@
66

77

88
serve_development_app = starlette.serve_development_app
9-
"""Alias for :func:`idom.server.starlette.serve_development_app`"""
9+
"""Alias for :func:`idom.backend.starlette.serve_development_app`"""
1010

1111
# see: https://github.com/idom-team/flake8-idom-hooks/issues/12
1212
use_location = starlette.use_location # noqa: ROH101
13-
"""Alias for :func:`idom.server.starlette.use_location`"""
13+
"""Alias for :func:`idom.backend.starlette.use_location`"""
1414

1515
# see: https://github.com/idom-team/flake8-idom-hooks/issues/12
1616
use_scope = starlette.use_scope # noqa: ROH101
17-
"""Alias for :func:`idom.server.starlette.use_scope`"""
17+
"""Alias for :func:`idom.backend.starlette.use_scope`"""
1818

1919
# see: https://github.com/idom-team/flake8-idom-hooks/issues/12
2020
use_websocket = starlette.use_websocket # noqa: ROH101
21-
"""Alias for :func:`idom.server.starlette.use_websocket`"""
21+
"""Alias for :func:`idom.backend.starlette.use_websocket`"""
2222

2323
Options = starlette.Options
24-
"""Alias for :class:`idom.server.starlette.Options`"""
24+
"""Alias for :class:`idom.backend.starlette.Options`"""
2525

2626
configure = starlette.configure
27-
"""Alias for :class:`idom.server.starlette.configure`"""
27+
"""Alias for :class:`idom.backend.starlette.configure`"""
2828

2929

3030
def create_development_app() -> FastAPI:

src/idom/backend/flask.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def configure(
4747
) -> None:
4848
"""Return a :class:`FlaskServer` where each client has its own state.
4949
50-
Implements the :class:`~idom.server.proto.ServerFactory` protocol
51-
5250
Parameters:
5351
constructor: A component constructor
5452
options: Options for configuring server behavior

src/idom/backend/starlette.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ def configure(
4242
) -> None:
4343
"""Return a :class:`StarletteServer` where each client has its own state.
4444
45-
Implements the :class:`~idom.server.proto.ServerFactory` protocol
46-
4745
Parameters:
4846
app: An application instance
4947
constructor: A component constructor

src/idom/backend/tornado.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ def configure(
3838
) -> None:
3939
"""Return a :class:`TornadoServer` where each client has its own state.
4040
41-
Implements the :class:`~idom.server.proto.ServerFactory` protocol
42-
4341
Parameters:
4442
app: A tornado ``Application`` instance.
4543
component: A root component constructor

src/idom/testing/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
assert_idom_did_not_log,
77
capture_idom_logs,
88
)
9-
from .server import ServerFixture
9+
from .backend import BackendFixture
1010

1111

1212
__all__ = [
@@ -18,6 +18,6 @@
1818
"HookCatcher",
1919
"LogAssertionError",
2020
"poll",
21-
"ServerFixture",
21+
"BackendFixture",
2222
"StaticEventHandler",
2323
]

src/idom/testing/server.py renamed to src/idom/testing/backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from .logs import LogAssertionError, capture_idom_logs, list_logged_exceptions
1616

1717

18-
class ServerFixture:
18+
class BackendFixture:
1919
"""A test fixture for running a server and imperatively displaying views
2020
2121
This fixture is typically used alongside async web drivers like ``playwight``.
@@ -99,7 +99,7 @@ def list_logged_exceptions(
9999
del_log_records,
100100
)
101101

102-
async def __aenter__(self) -> ServerFixture:
102+
async def __aenter__(self) -> BackendFixture:
103103
self._exit_stack = AsyncExitStack()
104104
self._records = self._exit_stack.enter_context(capture_idom_logs())
105105

src/idom/testing/display.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from idom import html
1010
from idom.types import RootComponentConstructor
1111

12-
from .server import ServerFixture
12+
from .backend import BackendFixture
1313

1414

1515
class DisplayFixture:
@@ -19,11 +19,11 @@ class DisplayFixture:
1919

2020
def __init__(
2121
self,
22-
server: ServerFixture | None = None,
22+
server: BackendFixture | None = None,
2323
driver: Browser | BrowserContext | Page | None = None,
2424
) -> None:
2525
if server is not None:
26-
self.server = server
26+
self.backend = server
2727
if driver is not None:
2828
if isinstance(driver, Page):
2929
self.page = driver
@@ -37,13 +37,13 @@ async def show(
3737
) -> None:
3838
self._next_view_id += 1
3939
view_id = f"display-{self._next_view_id}"
40-
self.server.mount(lambda: html.div({"id": view_id}, component()))
40+
self.backend.mount(lambda: html.div({"id": view_id}, component()))
4141

4242
await self.goto("/")
4343
await self.page.wait_for_selector(f"#{view_id}", state="attached")
4444

4545
async def goto(self, path: str, query: Any | None = None) -> None:
46-
await self.page.goto(self.server.url(path, query))
46+
await self.page.goto(self.backend.url(path, query))
4747

4848
async def __aenter__(self) -> DisplayFixture:
4949
es = self._exit_stack = AsyncExitStack()
@@ -58,8 +58,8 @@ async def __aenter__(self) -> DisplayFixture:
5858
self.page = await browser.new_page()
5959

6060
if not hasattr(self, "server"):
61-
self.server = ServerFixture()
62-
await es.enter_async_context(self.server)
61+
self.backend = BackendFixture()
62+
await es.enter_async_context(self.backend)
6363

6464
return self
6565

@@ -69,5 +69,5 @@ async def __aexit__(
6969
exc_value: BaseException | None,
7070
traceback: TracebackType | None,
7171
) -> None:
72-
self.server.mount(None)
72+
self.backend.mount(None)
7373
await self._exit_stack.aclose()

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from idom.config import IDOM_TESTING_DEFAULT_TIMEOUT
1111
from idom.testing import (
1212
DisplayFixture,
13-
ServerFixture,
13+
BackendFixture,
1414
capture_idom_logs,
1515
clear_idom_web_modules_dir,
1616
)
@@ -34,7 +34,7 @@ async def display(server, page):
3434

3535
@pytest.fixture(scope="session")
3636
async def server():
37-
async with ServerFixture() as server:
37+
async with BackendFixture() as server:
3838
yield server
3939

4040

tests/test_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from playwright.async_api import Browser
66

77
import idom
8-
from idom.testing import DisplayFixture, ServerFixture
8+
from idom.testing import DisplayFixture, BackendFixture
99

1010

1111
JS_DIR = Path(__file__).parent / "js"
@@ -22,7 +22,7 @@ def OldComponent():
2222
return idom.html.p({"id": "old-component"}, "old")
2323

2424
async with AsyncExitStack() as exit_stack:
25-
server = await exit_stack.enter_async_context(ServerFixture(port=8000))
25+
server = await exit_stack.enter_async_context(BackendFixture(port=8000))
2626
display = await exit_stack.enter_async_context(
2727
DisplayFixture(server, driver=page)
2828
)
@@ -43,7 +43,7 @@ def NewComponent():
4343
return idom.html.p({"id": f"new-component-{state}"}, f"new-{state}")
4444

4545
async with AsyncExitStack() as exit_stack:
46-
server = await exit_stack.enter_async_context(ServerFixture(port=8000))
46+
server = await exit_stack.enter_async_context(BackendFixture(port=8000))
4747
display = await exit_stack.enter_async_context(
4848
DisplayFixture(server, driver=page)
4949
)

tests/test_server/test_common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from idom.backend import default as default_implementation
88
from idom.backend.types import Location
99
from idom.backend.utils import all_implementations
10-
from idom.testing import DisplayFixture, ServerFixture, poll
10+
from idom.testing import DisplayFixture, BackendFixture, poll
1111

1212

1313
@pytest.fixture(
@@ -16,7 +16,7 @@
1616
scope="module",
1717
)
1818
async def display(page, request):
19-
async with ServerFixture(implementation=request.param) as server:
19+
async with BackendFixture(implementation=request.param) as server:
2020
async with DisplayFixture(server=server, driver=page) as display:
2121
yield display
2222

@@ -69,7 +69,7 @@ async def test_use_scope(display: DisplayFixture):
6969

7070
@idom.component
7171
def ShowScope():
72-
scope.current = display.server.implementation.use_scope()
72+
scope.current = display.backend.implementation.use_scope()
7373
return html.pre({"id": "scope"}, str(scope.current))
7474

7575
await display.show(ShowScope)
@@ -88,7 +88,7 @@ async def poll_location():
8888

8989
@idom.component
9090
def ShowRoute():
91-
location.current = display.server.implementation.use_location()
91+
location.current = display.backend.implementation.use_location()
9292
return html.pre({"id": "scope"}, str(location.current))
9393

9494
await display.show(ShowRoute)

0 commit comments

Comments
 (0)