Skip to content

Commit db6658e

Browse files
authored
chore: explicitly add anyio to dependencies (#2045)
* chore: explicitly add anyio to dependencies * tests: fix ResourceWarning
1 parent 08c2421 commit db6658e

File tree

4 files changed

+269
-259
lines changed

4 files changed

+269
-259
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ dependencies = [
1111
"pypika-tortoise (>=0.6.3,<1.0.0)",
1212
"iso8601 (>=2.1.0,<3.0.0); python_version < '4.0'",
1313
"aiosqlite (>=0.16.0,<1.0.0)",
14+
"anyio",
1415
"pytz",
15-
# Typing support for older Python
16-
"typing-extensions (>= 4.1.0)",
16+
"typing-extensions (>= 4.1.0); python_version < '3.11'",
1717
]
1818
classifiers = [
1919
"License :: OSI Approved :: Apache Software License",

tests/test_table_name.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ async def test_glabal_name_generator(self):
3636

3737
async def test_custom_table_name_precedence(self):
3838
self.assertEqual(CustomTable._meta.db_table, "my_custom_table")
39+
40+
async def _tearDownDB(self) -> None:
41+
# Explicitly close aiosqlite connection to fix ResourceWarning
42+
await Tortoise.get_connection("default").close()

tortoise/filters.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import operator
4+
import sys
45
from collections.abc import Callable, Iterable, Sequence
56
from functools import partial
67
from typing import TYPE_CHECKING, Any, TypedDict
@@ -16,12 +17,16 @@
1617
Term,
1718
ValueWrapper,
1819
)
19-
from typing_extensions import NotRequired
2020

2121
from tortoise.contrib.postgres.fields import ArrayField
2222
from tortoise.fields import Field, JSONField
2323
from tortoise.fields.relational import BackwardFKRelation, ManyToManyFieldInstance
2424

25+
if sys.version_info >= (3, 11): # pragma:nocoverage
26+
from typing import NotRequired
27+
else:
28+
from typing_extensions import NotRequired
29+
2530
if TYPE_CHECKING: # pragma: nocoverage
2631
from tortoise.models import Model
2732

0 commit comments

Comments
 (0)