Skip to content

Commit

Permalink
Add pragma for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Nov 20, 2024
1 parent c43aa41 commit 09edfbc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion nextlinegraphql/custom/strawberry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Strawberry: https://strawberry.rocks
'''

from typing import TYPE_CHECKING

from strawberry.asgi import GraphQL as GraphQL_
Expand All @@ -16,7 +17,7 @@ class GraphQL(GraphQL_):

async def __call__(self, scope: 'Scope', receive: 'Receive', send: 'Send') -> None:
if scope["type"] == "websocket":
if not scope.get("subprotocols"):
if not scope.get("subprotocols"): # pragma: no branch
# strawberry closes the websocket connection if
# subprotocols are empty, which is the case for
# async_asgi_testclient.
Expand Down
4 changes: 3 additions & 1 deletion nextlinegraphql/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def create_app() -> Starlette:
async def lifespan(app: Starlette) -> AsyncIterator[None]:
context = dict[Any, Any]()
await hook.ahook.update_lifespan_context(app=app, hook=hook, context=context)
async with hook.awith.lifespan(app=app, hook=hook, context=context):
async with hook.awith.lifespan(
app=app, hook=hook, context=context
): # pragma: no branch
yield

middleware = [
Expand Down
3 changes: 2 additions & 1 deletion nextlinegraphql/hook/spec.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'''Hook specification for Nextline GraphQL plugin.'''

from collections.abc import AsyncIterator, MutableMapping, Sequence
from typing import Optional

Expand Down Expand Up @@ -71,7 +72,7 @@ async def lifespan(
The Starlette lifespan yields within this hook
'''
yield
yield # pragma: no cover


@hookspec
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/ctrl/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async def test_plugin(client: TestClient) -> None:

async def _subscribe_state(client: TestClient) -> list[str]:
ret = []
async for data in gql_subscribe(client, SUBSCRIBE_STATE):
async for data in gql_subscribe(client, SUBSCRIBE_STATE): # pragma: no branch
s = data['ctrlState']
ret.append(s)
if s == 'finished':
Expand Down

0 comments on commit 09edfbc

Please sign in to comment.