Skip to content

Commit b6c7bfa

Browse files
committed
testing under python 3.8~3.11
1 parent cbc9f8f commit b6c7bfa

File tree

6 files changed

+160
-14
lines changed

6 files changed

+160
-14
lines changed

poetry.lock

Lines changed: 125 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,32 @@
22
pytest = "^7.3.1"
33
pytest-asyncio = "^0.21.0"
44
pytest-docker-service = "^0.2.4"
5+
tox = "^4.6.0"
56

67
[tool.poetry.group.dev.dependencies]
78
yapf = "^0.33.0"
89
black = "^23.3.0"
910
ruff = "^0.0.267"
1011

12+
[tool.tox]
13+
# See https://python-poetry.org/docs/master/faq/#usecase-3
14+
legacy_tox_ini = """
15+
[tox]
16+
isolated_build = true
17+
18+
env_list =
19+
py38
20+
py39
21+
py310
22+
py311
23+
24+
[testenv]
25+
skip_install = true
26+
allowlist_externals = poetry
27+
commands_pre = poetry install -v --only=main,test
28+
commands = poetry run pytest -vx
29+
"""
30+
1131
[tool.pytest.ini_options]
1232
asyncio_mode = "auto"
1333

@@ -16,7 +36,7 @@ ignore = ["E501"]
1636

1737
[tool.poetry]
1838
name = "sqlalchemy-nested-mutable"
19-
version = "0.0.1"
39+
version = "0.1.0"
2040
readme = "README.md"
2141
description = "SQLAlchemy Nested Mutable Types."
2242
authors = ["Wonder <wonderbeyond@gmail.com>"]
@@ -39,8 +59,9 @@ packages = [
3959
[tool.poetry.dependencies]
4060
python = "^3.8"
4161
sqlalchemy = "^2.0"
42-
psycopg2-binary = "^2.9.6"
43-
pydantic = "^1.10.8"
62+
psycopg2-binary = "^2.8"
63+
pydantic = "^1.10.0"
64+
typing-extensions = "^4.5.0"
4465

4566
[build-system]
4667
requires = ["poetry-core>=1.0.0"]

sqlalchemy_nested_mutable/mutable.py

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

3-
from typing import TYPE_CHECKING, List, Iterable, TypeVar, Self
3+
from typing import TYPE_CHECKING, List, Iterable, TypeVar
4+
from typing_extensions import Self
45

56
import sqlalchemy as sa
67
from sqlalchemy.ext.mutable import Mutable

sqlalchemy_nested_mutable/trackable.py

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

3-
from typing import TYPE_CHECKING, Optional, Union, Any, Tuple, Dict, List, Iterable, Self, overload
3+
from typing import TYPE_CHECKING, Optional, Union, Any, Tuple, Dict, List, Iterable, overload
4+
from typing_extensions import Self
45
from weakref import WeakValueDictionary
56

67
from sqlalchemy.util.typing import SupportsIndex, TypeGuard

tests/test_mutable_list.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import List
2+
13
import pytest
24
import sqlalchemy as sa
35
from sqlalchemy.dialects.postgresql import ARRAY, JSONB
@@ -22,7 +24,7 @@ class User(Base):
2224
name: Mapped[str] = mapped_column(sa.String(30))
2325
aliases = mapped_column(MutableList[str].as_mutable(ARRAY(sa.String(128))), default=list)
2426
schedule = mapped_column(
25-
MutableList[list[str]].as_mutable(ARRAY(sa.String(128), dimensions=2)), default=list
27+
MutableList[List[str]].as_mutable(ARRAY(sa.String(128), dimensions=2)), default=list
2628
) # a user's weekly schedule, e.g. [ ['meeting', 'launch'], ['training', 'presentation'] ]
2729

2830

@@ -33,7 +35,7 @@ class UserV2(Base):
3335
id: Mapped[int] = mapped_column(primary_key=True)
3436
name: Mapped[str] = mapped_column(sa.String(30))
3537
aliases = mapped_column(MutableList[str].as_mutable(JSONB), default=list)
36-
schedule = mapped_column(MutableList[list[str]].as_mutable(JSONB), default=list)
38+
schedule = mapped_column(MutableList[List[str]].as_mutable(JSONB), default=list)
3739

3840

3941
@pytest.fixture(scope="module", autouse=True)

tests/test_mutable_pydantic_type.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional
1+
from typing import Optional, List
22

33
import pytest
44
from sqlalchemy_nested_mutable._compat import pydantic
@@ -27,8 +27,8 @@ class AddressItem(pydantic.BaseModel):
2727
area: Optional[str]
2828

2929
preferred: Optional[AddressItem]
30-
work: list[AddressItem] = []
31-
home: list[AddressItem] = []
30+
work: List[AddressItem] = []
31+
home: List[AddressItem] = []
3232
updated_time: Optional[str]
3333

3434

0 commit comments

Comments
 (0)