Skip to content

Commit 79d6328

Browse files
committed
minor updates
1 parent 8bab499 commit 79d6328

File tree

9 files changed

+24
-333
lines changed

9 files changed

+24
-333
lines changed

idom/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
# pragma: no cover
12
import sys
23

34
from loguru import logger
45

5-
# pragma: no cover
66
from .cli import main
77

88

idom/client/manage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def web_module_names() -> Set[str]:
4343
}
4444

4545

46-
def register_web_module(package_name: str, source: Union[Path, str]) -> str:
46+
def add_web_module(package_name: str, source: Union[Path, str]) -> str:
4747
source = Path(source)
4848
if not source.exists():
4949
raise FileNotFoundError(f"Package source file does not exist: {str(source)!r}")
@@ -65,7 +65,7 @@ def web_module_path(package_name: str, must_exist: bool = False) -> Path:
6565

6666

6767
def restore() -> None:
68-
build(clean_build=True)
68+
build([], clean_build=True)
6969

7070

7171
def build(packages_to_install: Sequence[str], clean_build: bool = False) -> None:

idom/client/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(
7777
self.fallback = fallback
7878
self.exports: Optional[List[str]] = None
7979
if source_file is not None:
80-
self.url = client.current.register_web_module(url_or_name, source_file)
80+
self.url = client.current.add_web_module(url_or_name, source_file)
8181
if check_exports:
8282
self.exports = client.current.web_module_exports(url_or_name)
8383
elif client.current.web_module_exists(url_or_name):

idom/client/protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def web_module_names(self) -> Set[str]:
2626
def web_module_path(self, package_name: str) -> Path:
2727
"""Return the path to a web module's source"""
2828

29-
def register_web_module(self, package_name: str, source: Union[Path, str]) -> str:
29+
def add_web_module(self, package_name: str, source: Union[Path, str]) -> str:
3030
"""Return the URL of a module added under the given ``name`` and contents of ``source``"""
3131

3232

tests/conftest.py

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging
22
import inspect
33
import time
4-
from copy import deepcopy
54
from typing import Callable, Any, Type, Tuple, Iterator, Iterable, Union
65

76
import sanic
@@ -17,11 +16,7 @@
1716
import pyalect.builtins.pytest # noqa
1817

1918
import idom
20-
from idom.client.manage import (
21-
build_config,
22-
build as build_client,
23-
restore as restore_client,
24-
)
19+
from idom.client import manage as manage_client
2520
from idom.core import ElementConstructor, AbstractElement
2621
from idom.server.prefab import hotswap_server, AbstractRenderServer
2722
from idom.server.utils import find_available_port
@@ -272,31 +267,6 @@ def _clean_last_server_error(last_server_error) -> Iterator[None]:
272267
yield
273268

274269

275-
@pytest.fixture
276-
def install():
277-
def add_dependency(*packages):
278-
config = build_config()
279-
with config.change_entry("tests") as entry:
280-
old_js_deps = entry.setdefault("js_dependencies", [])
281-
new_js_deps = set(packages).union(old_js_deps)
282-
entry["js_dependencies"] = list(new_js_deps)
283-
if old_js_deps != new_js_deps:
284-
build_client()
285-
286-
return add_dependency
287-
288-
289-
@pytest.fixture
290-
def temp_build_config():
291-
config = build_config()
292-
original_cfgs = [deepcopy(cfg) for cfg in config.data["entries"].values()]
293-
try:
294-
yield config
295-
finally:
296-
config.update_entries(original_cfgs)
297-
config.save()
298-
299-
300270
@pytest.fixture(scope="session", autouse=True)
301271
def _restore_client(pytestconfig: Config) -> Iterator[None]:
302272
"""Restore the client's state before and after testing
@@ -306,8 +276,8 @@ def _restore_client(pytestconfig: Config) -> Iterator[None]:
306276
after testing and may effect usage of IDOM beyond the scope of the tests.
307277
"""
308278
if pytestconfig.option.restore_client:
309-
restore_client()
279+
manage_client.restore()
310280
yield
311-
restore_client()
281+
manage_client.restore()
312282
else:
313283
yield

tests/test_client/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55

66
@pytest.fixture
77
def victory_js(install):
8-
install("victory@35.4.0")
9-
return idom.Module("victory")
8+
return idom.install("victory@35.4.0")

tests/test_client/test_build_config.py

Lines changed: 0 additions & 280 deletions
This file was deleted.

0 commit comments

Comments
 (0)