Skip to content

Commit ed7b56c

Browse files
committed
ignore missing coverage
1 parent 3f84313 commit ed7b56c

24 files changed

+47
-47
lines changed

src/py/reactpy/reactpy/_console/ast_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def rewrite_changed_nodes(
3737
):
3838
nodes_to_unparse.append(current_node)
3939
break
40-
else: # pragma: no cover
40+
else: # nocov
4141
msg = "Failed to change code"
4242
raise RuntimeError(msg)
4343

src/py/reactpy/reactpy/_console/rewrite_camel_case_props.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
@click.argument("paths", nargs=-1, type=click.Path(exists=True))
2424
def rewrite_camel_case_props(paths: list[str]) -> None:
2525
"""Rewrite camelCase props to snake_case"""
26-
if sys.version_info < (3, 9): # pragma: no cover
26+
if sys.version_info < (3, 9): # nocov
2727
msg = "This command requires Python>=3.9"
2828
raise RuntimeError(msg)
2929

src/py/reactpy/reactpy/_console/rewrite_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def rewrite_keys(paths: list[str]) -> None:
4545
just above its changes. As such it requires manual intervention to put those
4646
comments back in their original location.
4747
"""
48-
if sys.version_info < (3, 9): # pragma: no cover
48+
if sys.version_info < (3, 9): # nocov
4949
msg = "This command requires Python>=3.9"
5050
raise RuntimeError(msg)
5151

src/py/reactpy/reactpy/_option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __repr__(self) -> str:
119119
return f"Option({self._name}={self.current!r})"
120120

121121

122-
class DeprecatedOption(Option[_O]): # pragma: no cover
122+
class DeprecatedOption(Option[_O]): # nocov
123123
def __init__(self, message: str, *args: Any, **kwargs: Any) -> None:
124124
self._deprecation_message = message
125125
super().__init__(*args, **kwargs)

src/py/reactpy/reactpy/backend/_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async def serve_development_asgi(
5353
# Since we aren't using the uvicorn's `run()` API, we can't guarantee uvicorn's
5454
# order of operations. So we need to make sure `shutdown()` always has an initialized
5555
# list of `self.servers` to use.
56-
if not hasattr(server, "servers"): # pragma: no cover
56+
if not hasattr(server, "servers"): # nocov
5757
server.servers = []
5858
await asyncio.wait_for(server.shutdown(), timeout=3)
5959

src/py/reactpy/reactpy/backend/default.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def configure(
1616
app: Any, component: RootComponentConstructor, options: None = None
1717
) -> None:
1818
"""Configure the given app instance to display the given component"""
19-
if options is not None: # pragma: no cover
19+
if options is not None: # nocov
2020
msg = "Default implementation cannot be configured with options"
2121
raise ValueError(msg)
2222
return _default_implementation().configure(app, component)
@@ -27,7 +27,7 @@ def create_development_app() -> Any:
2727
return _default_implementation().create_development_app()
2828

2929

30-
def Options(*args: Any, **kwargs: Any) -> NoReturn: # pragma: no cover
30+
def Options(*args: Any, **kwargs: Any) -> NoReturn: # nocov
3131
"""Create configuration options"""
3232
msg = "Default implementation has no options."
3333
raise ValueError(msg)
@@ -57,7 +57,7 @@ def _default_implementation() -> BackendImplementation[Any]:
5757

5858
try:
5959
implementation = next(all_implementations())
60-
except StopIteration: # pragma: no cover
60+
except StopIteration: # nocov
6161
logger.debug("Backend implementation import failed", exc_info=exc_info())
6262
msg = "No built-in server implementation installed."
6363
raise RuntimeError(msg) from None

src/py/reactpy/reactpy/backend/flask.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def run_server() -> None:
111111
# the thread should eventually join
112112
thread.join(timeout=3)
113113
# just double check it happened
114-
if thread.is_alive(): # pragma: no cover
114+
if thread.is_alive(): # nocov
115115
msg = "Failed to shutdown server."
116116
raise RuntimeError(msg)
117117

@@ -129,7 +129,7 @@ def use_request() -> Request:
129129
def use_connection() -> Connection[_FlaskCarrier]:
130130
"""Get the current :class:`Connection`"""
131131
conn = _use_connection()
132-
if not isinstance(conn.carrier, _FlaskCarrier): # pragma: no cover
132+
if not isinstance(conn.carrier, _FlaskCarrier): # nocov
133133
msg = f"Connection has unexpected carrier {conn.carrier}. Are you running with a Flask server?"
134134
raise TypeError(msg)
135135
return conn
@@ -152,7 +152,7 @@ def _setup_common_routes(
152152
options: Options,
153153
) -> None:
154154
cors_options = options.cors
155-
if cors_options: # pragma: no cover
155+
if cors_options: # nocov
156156
cors_params = cors_options if isinstance(cors_options, dict) else {}
157157
CORS(api_blueprint, **cors_params)
158158

@@ -258,7 +258,7 @@ async def main() -> None:
258258
dispatch_thread_info = cast(_DispatcherThreadInfo, dispatch_thread_info_ref.current)
259259

260260
if dispatch_thread_info is None:
261-
raise RuntimeError("Failed to create dispatcher thread")
261+
raise RuntimeError("Failed to create dispatcher thread") # nocov
262262

263263
stop = ThreadEvent()
264264

@@ -274,7 +274,7 @@ def run_send() -> None:
274274
dispatch_thread_info.dispatch_loop.call_soon_threadsafe(
275275
dispatch_thread_info.async_recv_queue.put_nowait, value
276276
)
277-
finally: # pragma: no cover
277+
finally: # nocov
278278
dispatch_thread_info.dispatch_loop.call_soon_threadsafe(
279279
dispatch_thread_info.dispatch_future.cancel
280280
)

src/py/reactpy/reactpy/backend/hooks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
def use_connection() -> Connection[Any]:
1414
"""Get the current :class:`~reactpy.backend.types.Connection`."""
1515
conn = use_context(ConnectionContext)
16-
if conn is None:
16+
if conn is None: # nocov
1717
msg = "No backend established a connection."
18-
raise RuntimeError(msg) # pragma: no cover
18+
raise RuntimeError(msg)
1919
return conn
2020

2121

src/py/reactpy/reactpy/backend/sanic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def use_websocket() -> WebSocketConnection:
8080
def use_connection() -> Connection[_SanicCarrier]:
8181
"""Get the current :class:`Connection`"""
8282
conn = _use_connection()
83-
if not isinstance(conn.carrier, _SanicCarrier): # pragma: no cover
83+
if not isinstance(conn.carrier, _SanicCarrier): # nocov
8484
msg = f"Connection has unexpected carrier {conn.carrier}. Are you running with a Sanic server?"
8585
raise TypeError(msg)
8686
return conn
@@ -103,7 +103,7 @@ def _setup_common_routes(
103103
options: Options,
104104
) -> None:
105105
cors_options = options.cors
106-
if cors_options: # pragma: no cover
106+
if cors_options: # nocov
107107
cors_params = cors_options if isinstance(cors_options, dict) else {}
108108
CORS(api_blueprint, **cors_params)
109109

@@ -159,7 +159,7 @@ async def model_stream(
159159
) -> None:
160160
asgi_app = getattr(request.app, "_asgi_app", None)
161161
scope = asgi_app.transport.scope if asgi_app else {}
162-
if not scope: # pragma: no cover
162+
if not scope: # nocov
163163
logger.warning("No scope. Sanic may not be running with an ASGI server")
164164

165165
send, recv = _make_send_recv_callbacks(socket)

src/py/reactpy/reactpy/backend/starlette.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def use_websocket() -> WebSocket:
7676

7777
def use_connection() -> Connection[WebSocket]:
7878
conn = _use_connection()
79-
if not isinstance(conn.carrier, WebSocket): # pragma: no cover
79+
if not isinstance(conn.carrier, WebSocket): # nocov
8080
msg = f"Connection has unexpected carrier {conn.carrier}. Are you running with a Flask server?"
8181
raise TypeError(msg)
8282
return conn
@@ -95,7 +95,7 @@ class Options(CommonOptions):
9595

9696
def _setup_common_routes(options: Options, app: Starlette) -> None:
9797
cors_options = options.cors
98-
if cors_options: # pragma: no cover
98+
if cors_options: # nocov
9999
cors_params = (
100100
cors_options if isinstance(cors_options, dict) else {"allow_origins": ["*"]}
101101
)

src/py/reactpy/reactpy/backend/tornado.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def use_request() -> HTTPServerRequest:
9898

9999
def use_connection() -> Connection[HTTPServerRequest]:
100100
conn = _use_connection()
101-
if not isinstance(conn.carrier, HTTPServerRequest): # pragma: no cover
101+
if not isinstance(conn.carrier, HTTPServerRequest): # nocov
102102
msg = f"Connection has unexpected carrier {conn.carrier}. Are you running with a Flask server?"
103103
raise TypeError(msg)
104104
return conn

src/py/reactpy/reactpy/backend/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ def all_implementations() -> Iterator[BackendImplementation[Any]]:
7979
try:
8080
relative_import_name = f"{__name__.rsplit('.', 1)[0]}.{name}"
8181
module = import_module(relative_import_name)
82-
except ImportError: # pragma: no cover
82+
except ImportError: # nocov
8383
logger.debug(f"Failed to import {name!r}", exc_info=True)
8484
continue
8585

86-
if not isinstance(module, BackendImplementation): # pragma: no cover
86+
if not isinstance(module, BackendImplementation): # nocov
8787
msg = f"{module.__name__!r} is an invalid implementation"
8888
raise TypeError(msg)
8989

src/py/reactpy/reactpy/core/_f_back.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
def f_module_name(index: int = 0) -> str:
88
frame = f_back(index + 1)
99
if frame is None:
10-
return "" # pragma: no cover
10+
return "" # nocov
1111
name = frame.f_globals.get("__name__", "")
1212
if not isinstance(name, str):
13-
raise TypeError("Expected module name to be a string")
13+
raise TypeError("Expected module name to be a string") # nocov
1414
return name
1515

1616

@@ -21,4 +21,4 @@ def f_back(index: int = 0) -> FrameType | None:
2121
return frame
2222
frame = frame.f_back
2323
index -= 1
24-
return None # pragma: no cover
24+
return None # nocov

src/py/reactpy/reactpy/core/hooks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,11 @@ def use_context(context: Context[_Type]) -> _Type:
248248
if provider is None:
249249
# same assertions but with normal exceptions
250250
if not isinstance(context, FunctionType):
251-
raise TypeError(f"{context} is not a Context")
251+
raise TypeError(f"{context} is not a Context") # nocov
252252
if context.__kwdefaults__ is None:
253-
raise TypeError(f"{context} has no 'value' kwarg")
253+
raise TypeError(f"{context} has no 'value' kwarg") # nocov
254254
if "value" not in context.__kwdefaults__:
255-
raise TypeError(f"{context} has no 'value' kwarg")
255+
raise TypeError(f"{context} has no 'value' kwarg") # nocov
256256
return cast(_Type, context.__kwdefaults__["value"])
257257

258258
return provider._value

src/py/reactpy/reactpy/core/layout.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Layout:
4545
"_model_states_by_life_cycle_state_id",
4646
]
4747

48-
if not hasattr(abc.ABC, "__weakref__"): # pragma: no cover
48+
if not hasattr(abc.ABC, "__weakref__"): # nocov
4949
__slots__.append("__weakref__")
5050

5151
def __init__(self, root: ComponentType) -> None:
@@ -197,7 +197,7 @@ def _render_model(
197197
) -> None:
198198
try:
199199
new_state.model.current = {"tagName": raw_model["tagName"]}
200-
except Exception as e: # pragma: no cover
200+
except Exception as e: # nocov
201201
msg = f"Expected a VDOM element dict, not {raw_model}"
202202
raise ValueError(msg) from e
203203
if "key" in raw_model:
@@ -595,13 +595,13 @@ def is_component_state(self) -> bool:
595595
def parent(self) -> _ModelState:
596596
parent = self._parent_ref()
597597
if parent is None:
598-
raise RuntimeError("detached model state")
598+
raise RuntimeError("detached model state") # nocov
599599
return parent
600600

601601
def append_child(self, child: Any) -> None:
602602
self.model.current["children"].append(child)
603603

604-
def __repr__(self) -> str: # pragma: no cover
604+
def __repr__(self) -> str: # nocov
605605
return f"ModelState({ {s: getattr(self, s, None) for s in self.__slots__} })"
606606

607607

src/py/reactpy/reactpy/core/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class State(NamedTuple, Generic[_Type]):
2828
value: _Type
2929
set_value: Callable[[_Type | Callable[[_Type], _Type]], None]
3030

31-
else: # pragma: no cover
31+
else: # nocov
3232
State = namedtuple("State", ("value", "set_value"))
3333

3434

src/py/reactpy/reactpy/core/vdom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def vdom(
162162
(subject to change) specifies javascript that, when evaluated returns a
163163
React component.
164164
"""
165-
if kwargs: # pragma: no cover
165+
if kwargs: # nocov
166166
if "key" in kwargs:
167167
if attributes_and_children:
168168
maybe_attributes, *children = attributes_and_children

src/py/reactpy/reactpy/testing/backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async def stop_server() -> None:
133133

134134
try:
135135
await asyncio.wait_for(started.wait(), timeout=self.timeout)
136-
except Exception: # pragma: no cover
136+
except Exception: # nocov
137137
# see if we can await the future for a more helpful error
138138
await asyncio.wait_for(server_future, timeout=self.timeout)
139139
raise
@@ -151,7 +151,7 @@ async def __aexit__(
151151
self.mount(None) # reset the view
152152

153153
logged_errors = self.list_logged_exceptions(del_log_records=False)
154-
if logged_errors: # pragma: no cover
154+
if logged_errors: # nocov
155155
msg = "Unexpected logged exception"
156156
raise LogAssertionError(msg) from logged_errors[0]
157157

src/py/reactpy/reactpy/testing/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async def until(
6666
result = await self._func(*self._args, **self._kwargs)
6767
if condition(result):
6868
break
69-
elif (time.time() - started_at) > timeout: # pragma: no cover
69+
elif (time.time() - started_at) > timeout: # nocov
7070
msg = f"Expected {description} after {timeout} seconds - last value was {result!r}"
7171
raise TimeoutError(msg)
7272

src/py/reactpy/reactpy/testing/display.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ async def goto(
5656

5757
async def root_element(self) -> ElementHandle:
5858
element = await self.page.wait_for_selector("#app", state="attached")
59-
if element is None:
59+
if element is None: # nocov
6060
msg = "Root element not attached"
61-
raise RuntimeError(msg) # pragma: no cover
61+
raise RuntimeError(msg)
6262
return element
6363

6464
async def __aenter__(self) -> DisplayFixture:

src/py/reactpy/reactpy/testing/logs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def assert_reactpy_did_log(
6161
)
6262
):
6363
break
64-
else: # pragma: no cover
64+
else: # nocov
6565
_raise_log_message_error(
6666
"Could not find a log record matching the given",
6767
match_message,

src/py/reactpy/reactpy/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def html_to_vdom(
9595
If ``True``, raise an exception if the HTML does not perfectly follow HTML5
9696
syntax.
9797
"""
98-
if not isinstance(html, str): # pragma: no cover
98+
if not isinstance(html, str): # nocov
9999
msg = f"Expected html to be a string, not {type(html).__name__}"
100100
raise TypeError(msg)
101101

@@ -112,7 +112,7 @@ def html_to_vdom(
112112
)
113113
except etree.XMLSyntaxError as e:
114114
if not strict:
115-
raise e # pragma: no cover
115+
raise e # nocov
116116
msg = "An error has occurred while parsing the HTML.\n\nThis HTML may be malformatted, or may not perfectly adhere to HTML5.\nIf you believe the exception above was due to something intentional, you can disable the strict parameter on html_to_vdom().\nOtherwise, repair your broken HTML and try again."
117117
raise HTMLParseError(msg) from e
118118

@@ -136,7 +136,7 @@ def _etree_to_vdom(
136136
dictionary which will be replaced by ``new``. For example, you could use a
137137
transform function to add highlighting to a ``<code/>`` block.
138138
"""
139-
if not isinstance(node, etree._Element): # pragma: no cover
139+
if not isinstance(node, etree._Element): # nocov
140140
msg = f"Expected node to be a etree._Element, not {type(node).__name__}"
141141
raise TypeError(msg)
142142

@@ -291,7 +291,7 @@ def _vdom_attr_to_html_str(key: str, value: Any) -> tuple[str, str]:
291291
):
292292
key = _CAMEL_CASE_SUB_PATTERN.sub("-", key)
293293

294-
if callable(value):
294+
if callable(value): # nocov
295295
raise TypeError(f"Cannot convert callable attribute {key}={value} to HTML")
296296

297297
# Again, we lower the attribute name only to normalize - HTML is case-insensitive:

src/py/reactpy/reactpy/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __call__(self, value: str) -> _CastTo:
9292

9393
def hotswap(
9494
update_on_change: bool = False,
95-
) -> tuple[_MountFunc, ComponentConstructor]: # pragma: no cover
95+
) -> tuple[_MountFunc, ComponentConstructor]: # nocov
9696
warn(
9797
"The 'hotswap' function is deprecated and will be removed in a future release",
9898
DeprecationWarning,

src/py/reactpy/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def browser(pytestconfig: Config):
5757

5858
@pytest.fixture(scope="session")
5959
def event_loop():
60-
if os.name == "nt": # pragma: no cover
60+
if os.name == "nt": # nocov
6161
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
6262
with open_event_loop() as loop:
6363
yield loop

0 commit comments

Comments
 (0)