Skip to content

Commit 48c6033

Browse files
authored
Merge pull request #129 from mschoettle/python313
Add support for Python 3.13
2 parents 9550804 + 1dc5b43 commit 48c6033

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
python-version: ["3.9", "3.10", "3.11", "3.12"]
27+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2828
pytest-version: ["7.0.0", "8.3.5"]
2929
pytest-asyncio-version: ["0.16.0", "0.23.0"]
30-
sqlalchemy-version: ["1.4.0", "2.0.40"]
30+
sqlalchemy-version: ["2.0.40"]
3131

3232
exclude:
3333
# old versions of pytest-asyncio use old pytest hook syntax

src/pytest_alembic/executor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ async def run(engine):
183183

184184
if isinstance(self.connection, Engine):
185185
with self.connection.begin() as connection:
186-
return fn(connection=connection, **kwargs)
186+
result = fn(connection=connection, **kwargs)
187+
188+
# SQLite does not close via the context manager, close expliclitly
189+
connection.close()
190+
return result
187191

188192
return fn(connection=self.connection, **kwargs)

src/pytest_alembic/plugin/fixtures.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,8 @@ def alembic_config() -> Union[Dict[str, Any], alembic.config.Config, Config]:
122122
@pytest.fixture()
123123
def alembic_engine():
124124
"""Override this fixture to provide pytest-alembic powered tests with a database handle."""
125-
return sqlalchemy.create_engine("sqlite:///")
125+
engine = sqlalchemy.create_engine("sqlite:///")
126+
try:
127+
yield engine
128+
finally:
129+
engine.dispose()

0 commit comments

Comments
 (0)