Skip to content

Commit

Permalink
improve test compat on windows and update gh workflows
Browse files Browse the repository at this point in the history
Change-Id: Ia58a2db5310626ac77d7bae73fbb978f01194384
  • Loading branch information
CaselIT committed Jan 21, 2025
1 parent 2d42642 commit 94f672c
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 100 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/run-on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ jobs:
# run this job using this matrix, excluding some combinations below.
matrix:
os:
- "ubuntu-latest"
- "ubuntu-22.04"
python-version:
- "3.11"
sqlalchemy:
- sqla13
- sqla14
- sqla20
- sqlamain
# abort all jobs as soon as one fails
fail-fast: true
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/run-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# run this job using this matrix, excluding some combinations below.
matrix:
os:
- "ubuntu-latest"
- "ubuntu-22.04"
- "windows-latest"
- "macos-latest"
python-version:
Expand All @@ -35,14 +35,24 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
sqlalchemy:
- sqla13
- sqla14
- sqla20
- sqlamain
exclude:
# sqla13 does not seem to support 3.12
# sqla13 does not support 3.12+
- sqlalchemy: sqla13
python-version: "3.12"
- sqlalchemy: sqla13
python-version: "3.13"
# sqla14 does not support 3.13+
- sqlalchemy: sqla14
python-version: "3.13"
# sqlamain does not support 3.8
- sqlalchemy: sqlamain
python-version: "3.8"

fail-fast: false

Expand Down Expand Up @@ -77,6 +87,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"

fail-fast: false

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/python/black
rev: 24.1.1
rev: 24.10.0
hooks:
- id: black

Expand Down
7 changes: 5 additions & 2 deletions alembic/context.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from __future__ import annotations
from typing import Any
from typing import Callable
from typing import Collection
from typing import ContextManager
from typing import Dict
from typing import Iterable
from typing import List
Expand All @@ -20,6 +19,8 @@ from typing import Tuple
from typing import TYPE_CHECKING
from typing import Union

from typing_extensions import ContextManager

if TYPE_CHECKING:
from sqlalchemy.engine.base import Connection
from sqlalchemy.engine.url import URL
Expand All @@ -40,7 +41,9 @@ if TYPE_CHECKING:

### end imports ###

def begin_transaction() -> Union[_ProxyTransaction, ContextManager[None]]:
def begin_transaction() -> (
Union[_ProxyTransaction, ContextManager[None, Optional[bool]]]
):
"""Return a context manager that will
enclose an operation within a "transaction",
as defined by the environment's offline
Expand Down
4 changes: 2 additions & 2 deletions alembic/runtime/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Any
from typing import Callable
from typing import Collection
from typing import ContextManager
from typing import Dict
from typing import List
from typing import Mapping
Expand All @@ -18,6 +17,7 @@

from sqlalchemy.sql.schema import Column
from sqlalchemy.sql.schema import FetchedValue
from typing_extensions import ContextManager
from typing_extensions import Literal

from .migration import _ProxyTransaction
Expand Down Expand Up @@ -976,7 +976,7 @@ def static_output(self, text: str) -> None:

def begin_transaction(
self,
) -> Union[_ProxyTransaction, ContextManager[None]]:
) -> Union[_ProxyTransaction, ContextManager[None, Optional[bool]]]:
"""Return a context manager that will
enclose an operation within a "transaction",
as defined by the environment's offline
Expand Down
4 changes: 2 additions & 2 deletions alembic/runtime/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from typing import Callable
from typing import cast
from typing import Collection
from typing import ContextManager
from typing import Dict
from typing import Iterable
from typing import Iterator
Expand All @@ -27,6 +26,7 @@
from sqlalchemy.engine import Engine
from sqlalchemy.engine import url as sqla_url
from sqlalchemy.engine.strategies import MockEngineStrategy
from typing_extensions import ContextManager

from .. import ddl
from .. import util
Expand Down Expand Up @@ -368,7 +368,7 @@ def upgrade():

def begin_transaction(
self, _per_migration: bool = False
) -> Union[_ProxyTransaction, ContextManager[None]]:
) -> Union[_ProxyTransaction, ContextManager[None, Optional[bool]]]:
"""Begin a logical transaction for migration operations.
This method is used within an ``env.py`` script to demarcate where
Expand Down
Loading

0 comments on commit 94f672c

Please sign in to comment.