Skip to content

Commit d5fada3

Browse files
committed
type hint fix
1 parent 927a80b commit d5fada3

File tree

12 files changed

+17
-15
lines changed

12 files changed

+17
-15
lines changed

context_async_sqlalchemy/test_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ async def rollback_session(
2828

2929

3030
@asynccontextmanager
31-
async def set_test_context(auto_close: bool = False) -> AsyncGenerator[None]:
31+
async def set_test_context(
32+
auto_close: bool = False,
33+
) -> AsyncGenerator[None, None]:
3234
"""
3335
Opens a context similar to middleware.
3436
@@ -56,7 +58,7 @@ async def set_test_context(auto_close: bool = False) -> AsyncGenerator[None]:
5658
async def put_savepoint_session_in_ctx(
5759
connection: DBConnect,
5860
session: AsyncSession,
59-
) -> AsyncGenerator[None]:
61+
) -> AsyncGenerator[None, None]:
6062
"""
6163
Sets the context to a session that uses a save point instead of creating
6264
a transaction. You need to pass the session you're using inside

docs/api/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ <h3 id="rollback_session">rollback_session</h3>
387387
<hr />
388388
<h3 id="set_test_context">set_test_context</h3>
389389
<pre><code class="language-python">@asynccontextmanager
390-
async def set_test_context(auto_close: bool = False) -&gt; AsyncGenerator[None]:
390+
async def set_test_context(auto_close: bool = False) -&gt; AsyncGenerator[None, None]:
391391
</code></pre>
392392
<p>A context manager that creates a new context in which you can place a
393393
dedicated test session.
@@ -403,7 +403,7 @@ <h3 id="put_savepoint_session_in_ctx">put_savepoint_session_in_ctx</h3>
403403
<pre><code class="language-python">async def put_savepoint_session_in_ctx(
404404
connection: DBConnect,
405405
session: AsyncSession,
406-
) -&gt; AsyncGenerator[None]:
406+
) -&gt; AsyncGenerator[None, None]:
407407
</code></pre>
408408
<p>Sets the context to a session that uses a save point instead of creating
409409
a transaction. You need to pass the session you're using inside

docs/search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/testing/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ <h2 id="override-context">Override context</h2>
173173
@pytest_asyncio.fixture(autouse=True)
174174
async def db_session_override(
175175
db_session_test: AsyncSession,
176-
) -&gt; AsyncGenerator[None]:
176+
) -&gt; AsyncGenerator[None, None]:
177177
&quot;&quot;&quot;
178178
The key thing about these tests is that we override the context in advance.
179179
The middleware has a special check that won't initialize the context

docs_sources/docs/api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ It’s intended for use in fixtures to execute SQL queries during tests.
317317
### set_test_context
318318
```python
319319
@asynccontextmanager
320-
async def set_test_context(auto_close: bool = False) -> AsyncGenerator[None]:
320+
async def set_test_context(auto_close: bool = False) -> AsyncGenerator[None, None]:
321321
```
322322
A context manager that creates a new context in which you can place a
323323
dedicated test session.
@@ -338,7 +338,7 @@ active, and you want all sessions to be closed automatically.
338338
async def put_savepoint_session_in_ctx(
339339
connection: DBConnect,
340340
session: AsyncSession,
341-
) -> AsyncGenerator[None]:
341+
) -> AsyncGenerator[None, None]:
342342
```
343343
Sets the context to a session that uses a save point instead of creating
344344
a transaction. You need to pass the session you're using inside

docs_sources/docs/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ from context_async_sqlalchemy.test_utils import (
9090
@pytest_asyncio.fixture(autouse=True)
9191
async def db_session_override(
9292
db_session_test: AsyncSession,
93-
) -> AsyncGenerator[None]:
93+
) -> AsyncGenerator[None, None]:
9494
"""
9595
The key thing about these tests is that we override the context in advance.
9696
The middleware has a special check that won't initialize the context

examples/fastapi_example/tests/non_transactional/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
@pytest_asyncio.fixture(autouse=True)
2323
async def cleanup_tables_after(
2424
app: FastAPI, # To make the connection to the database in lifespan
25-
) -> AsyncGenerator[None]:
25+
) -> AsyncGenerator[None, None]:
2626
"""
2727
After each test, we delete all data from the tables to isolate the data.
2828
We always clear the data after each test to avoid interfering with

examples/fastapi_example/tests/transactional/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@pytest_asyncio.fixture(autouse=True)
2626
async def db_session_override(
2727
db_session_test: AsyncSession,
28-
) -> AsyncGenerator[None]:
28+
) -> AsyncGenerator[None, None]:
2929
"""
3030
The key thing about these tests is that we override the context in advance.
3131
The middleware has a special check that won't initialize the context

examples/fastapi_with_pure_asgi_example/tests/non_transactional/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
@pytest_asyncio.fixture(autouse=True)
2323
async def cleanup_tables_after(
2424
app: FastAPI, # To make the connection to the database in lifespan
25-
) -> AsyncGenerator[None]:
25+
) -> AsyncGenerator[None, None]:
2626
"""
2727
After each test, we delete all data from the tables to isolate the data.
2828
We always clear the data after each test to avoid interfering with

examples/fastapi_with_pure_asgi_example/tests/transactional/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@pytest_asyncio.fixture(autouse=True)
2626
async def db_session_override(
2727
db_session_test: AsyncSession,
28-
) -> AsyncGenerator[None]:
28+
) -> AsyncGenerator[None, None]:
2929
"""
3030
The key thing about these tests is that we override the context in advance.
3131
The middleware has a special check that won't initialize the context

0 commit comments

Comments
 (0)