Skip to content

Commit bdac416

Browse files
committed
pragma to nocov
1 parent e5e2661 commit bdac416

File tree

12 files changed

+13
-46
lines changed

12 files changed

+13
-46
lines changed

src/reactpy/core/_life_cycle_hook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async def __call__(self, stop: Event) -> None: ...
2222
logger = logging.getLogger(__name__)
2323

2424

25-
class _HookStack(Singleton): # pragma: no cover
25+
class _HookStack(Singleton): # nocov
2626
"""A singleton object which manages the current component tree's hooks.
2727
Life cycle hooks can be stored in a thread local or context variable depending
2828
on the platform."""

src/reactpy/core/_thread_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
_StateType = TypeVar("_StateType")
66

77

8-
class ThreadLocal(Generic[_StateType]): # pragma: no cover
8+
class ThreadLocal(Generic[_StateType]): # nocov
99
"""Utility for managing per-thread state information. This is only used in
1010
environments where ContextVars are not available, such as the `pyodide`
1111
executor."""

src/reactpy/core/hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ def strictly_equal(x: Any, y: Any) -> bool:
613613
return x == y # type: ignore
614614

615615
# Fallback to identity check
616-
return x is y # pragma: no cover
616+
return x is y # nocov
617617

618618

619619
def run_effect_cleanup(cleanup_func: Ref[_EffectCleanFunc | None]) -> None:

src/reactpy/executors/asgi/middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ async def __call__(
166166
msg: dict[str, str] = orjson.loads(event["text"])
167167
if msg.get("type") == "layout-event":
168168
await ws.rendering_queue.put(msg)
169-
else: # pragma: no cover
169+
else: # nocov
170170
await asyncio.to_thread(
171171
_logger.warning, f"Unknown message type: {msg.get('type')}"
172172
)
@@ -205,7 +205,7 @@ async def run_dispatcher(self) -> None:
205205
# Determine component to serve by analyzing the URL and/or class parameters.
206206
if self.parent.multiple_root_components:
207207
url_match = re.match(self.parent.dispatcher_pattern, self.scope["path"])
208-
if not url_match: # pragma: no cover
208+
if not url_match: # nocov
209209
raise RuntimeError("Could not find component in URL path.")
210210
dotted_path = url_match["dotted_path"]
211211
if dotted_path not in self.parent.root_components:
@@ -215,7 +215,7 @@ async def run_dispatcher(self) -> None:
215215
component = self.parent.root_components[dotted_path]
216216
elif self.parent.root_component:
217217
component = self.parent.root_component
218-
else: # pragma: no cover
218+
else: # nocov
219219
raise RuntimeError("No root component provided.")
220220

221221
# Create a connection object by analyzing the websocket's query string.

src/reactpy/executors/asgi/pyscript.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def __init__(
7979
self.html_head = html_head or html.head()
8080
self.html_lang = html_lang
8181

82-
def match_dispatch_path(
83-
self, scope: AsgiWebsocketScope
84-
) -> bool: # pragma: no cover
82+
def match_dispatch_path(self, scope: AsgiWebsocketScope) -> bool: # nocov
8583
"""We do not use a WebSocket dispatcher for Client-Side Rendering (CSR)."""
8684
return False
8785

src/reactpy/executors/asgi/standalone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class ReactPyApp:
182182
async def __call__(
183183
self, scope: AsgiScope, receive: AsgiReceive, send: AsgiSend
184184
) -> None:
185-
if scope["type"] != "http": # pragma: no cover
185+
if scope["type"] != "http": # nocov
186186
if scope["type"] != "lifespan":
187187
msg = (
188188
"ReactPy app received unsupported request of type '%s' at path '%s'",

src/reactpy/executors/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def import_components(dotted_paths: Iterable[str]) -> dict[str, Any]:
2525
}
2626

2727

28-
def check_path(url_path: str) -> str: # pragma: no cover
28+
def check_path(url_path: str) -> str: # nocov
2929
"""Check that a path is valid URL path."""
3030
if not url_path:
3131
return "URL path must not be empty."

src/reactpy/pyscript/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def extend_pyscript_config(
144144
return orjson.dumps(pyscript_config).decode("utf-8")
145145

146146

147-
def reactpy_version_string() -> str: # pragma: no cover
147+
def reactpy_version_string() -> str: # nocov
148148
from reactpy.testing.common import GITHUB_ACTIONS
149149

150150
local_version = reactpy.__version__

src/reactpy/templatetags/jinja.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def render(self, *args: str, **kwargs: str) -> str:
2222
return pyscript_setup(*args, **kwargs)
2323

2424
# This should never happen, but we validate it for safety.
25-
raise ValueError(f"Unknown tag: {self.tag_name}") # pragma: no cover
25+
raise ValueError(f"Unknown tag: {self.tag_name}") # nocov
2626

2727

2828
def component(dotted_path: str, **kwargs: str) -> str:

src/reactpy/testing/display.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async def __aenter__(self) -> DisplayFixture:
5858

5959
self.page.set_default_timeout(REACTPY_TESTS_DEFAULT_TIMEOUT.current * 1000)
6060

61-
if not hasattr(self, "backend"): # pragma: no cover
61+
if not hasattr(self, "backend"): # nocov
6262
self.backend = BackendFixture()
6363
await es.enter_async_context(self.backend)
6464

src/reactpy/testing/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
def find_available_port(
99
host: str, port_min: int = 8000, port_max: int = 9000
10-
) -> int: # pragma: no cover
10+
) -> int: # nocov
1111
"""Get a port that's available for the given host and port range"""
1212
for port in range(port_min, port_max):
1313
with closing(socket.socket()) as sock:

tests/test_utils.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -153,37 +153,6 @@ def test_html_to_vdom_with_no_parent_node():
153153
assert utils.html_to_vdom(source) == expected
154154

155155

156-
def test_del_html_body_transform():
157-
source = """
158-
<!DOCTYPE html>
159-
<html lang="en">
160-
161-
<head>
162-
<title>My Title</title>
163-
</head>
164-
165-
<body><h1>Hello World</h1></body>
166-
167-
</html>
168-
"""
169-
170-
expected = {
171-
"tagName": "",
172-
"children": [
173-
{
174-
"tagName": "",
175-
"children": [{"tagName": "title", "children": ["My Title"]}],
176-
},
177-
{
178-
"tagName": "",
179-
"children": [{"tagName": "h1", "children": ["Hello World"]}],
180-
},
181-
],
182-
}
183-
184-
assert utils.html_to_vdom(source, utils.del_html_head_body_transform) == expected
185-
186-
187156
SOME_OBJECT = object()
188157

189158

0 commit comments

Comments
 (0)