Skip to content

Commit

Permalink
Merge "Do not assume that greenlet is installed" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzeek authored and Gerrit Code Review committed Nov 8, 2023
2 parents 0e0131b + d53e3e1 commit fba7492
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions alembic/testing/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ def sqlalchemy_2(self):
"SQLAlchemy 2.x test",
)

@property
def asyncio(self):
def go(config):
try:
import greenlet # noqa: F401
except ImportError:
return False
else:
return True

return self.sqlalchemy_14 + exclusions.only_if(go)

@property
def comments(self):
return exclusions.only_if(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ async def go(conn):
):
op.run_async(go)

@config.requirements.sqlalchemy_14
@config.requirements.asyncio
def test_run_async_ok(self):
from sqlalchemy.ext.asyncio import AsyncConnection

Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ deps=pytest>4.6
mako
python-dateutil
zimports
black==22.3.0
black==23.3.0
greenlet>=1



Expand Down

0 comments on commit fba7492

Please sign in to comment.