Skip to content

Commit e9352fb

Browse files
committed
Merge branch 'stable'
2 parents 510e63b + 802d4ce commit e9352fb

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

.github/workflows/tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
include:
16+
- {python: '3.14'}
1617
- {python: '3.13'}
1718
- {python: '3.12'}
1819
- {python: '3.11'}
1920
- {python: '3.10'}
2021
- {python: '3.9'}
22+
- {name: Minimum Versions, python: '3.14', tox: tests-min}
2123
steps:
2224
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2325
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2

docs/testing.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,28 +156,30 @@ import pytest
156156
from project import create_app, db
157157

158158
@pytest.fixture
159-
def app():
159+
def app(monkeypatch):
160160
app = create_app({
161161
"SQLALCHEMY_ENGINES": {"default": "postgresql:///project-test"}
162162
})
163-
164-
with app.app_context():
165-
engines = db.engines
166-
167163
cleanup = []
168164

169-
for key, engine in engines.items():
170-
connection = engine.connect()
171-
transaction = connection.begin()
172-
engines[key] = connection
173-
cleanup.append((key, engine, connection, transaction))
165+
with app.app_context():
166+
monkeypatch.setitem(
167+
db.sessionmaker.kw, "join_transaction_mode", "create_savepoint"
168+
)
169+
170+
for engine in db.engines.values():
171+
connection = engine.connect()
172+
transaction = connection.begin()
173+
cleanup.append(transaction.rollback)
174+
cleanup.append(connection.close)
175+
connection.close = lambda: None
176+
connection.begin = connection.begin_nested
177+
monkeypatch.setattr(engine, "connect", lambda _c=connection: _c)
174178

175179
yield app
176180

177-
for key, engine, connection, transaction in cleanup:
178-
transaction.rollback()
179-
connection.close()
180-
engines[key] = engine
181+
for f in cleanup:
182+
f()
181183
```
182184

183185
This is not needed when using a SQLite in memory database as discussed above, as

pyproject.toml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ classifiers = [
1414
]
1515
requires-python = ">=3.9"
1616
dependencies = [
17-
"flask[async]",
18-
"sqlalchemy[asyncio]",
17+
"flask[async]>=3.0.0",
18+
"sqlalchemy[asyncio]>=2.0.31",
1919
]
2020

2121
[project.urls]
@@ -127,7 +127,8 @@ tag-only = [
127127

128128
[tool.tox]
129129
env_list = [
130-
"py3.13", "py3.12", "py3.11", "py3.10", "py3.9",
130+
"py3.14", "py3.13", "py3.12", "py3.11", "py3.10", "py3.9",
131+
"tests-min",
131132
"style",
132133
"typing",
133134
"docs",
@@ -146,6 +147,23 @@ commands = [[
146147
{ replace = "posargs", default = [], extend = true },
147148
]]
148149

150+
[tool.tox.env.tests-min]
151+
description = "pytest on minimum dependency versions"
152+
base_python = ["3.13"]
153+
commands_pre = [
154+
[
155+
"uv", "pip", "install",
156+
"flask[async]==3.0.0",
157+
"sqlalchemy==2.0.31",
158+
],
159+
]
160+
commands = [
161+
[
162+
"pytest", "-v", "--tb=short", "--basetemp={env_tmp_dir}",
163+
{ replace = "posargs", default = [], extend = true },
164+
],
165+
]
166+
149167
[tool.tox.env.style]
150168
description = "run all pre-commit hooks on all files"
151169
dependency_groups = ["pre-commit"]

uv.lock

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

0 commit comments

Comments
 (0)