Skip to content

Commit

Permalink
fix: reset between tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cofin committed Jun 30, 2024
1 parent b412dab commit ac908a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ venvPath = "."

[tool.unasyncd]
add_editors_note = true
cache = false
cache = true
ruff_fix = true
update_docstrings = true

Expand Down
11 changes: 8 additions & 3 deletions tests/unit/test_extensions/test_litestar/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, async_sessionmaker, create_async_engine
from sqlalchemy.orm import Session, sessionmaker

from advanced_alchemy.config.common import GenericSQLAlchemyConfig
from advanced_alchemy.extensions.litestar import SQLAlchemyAsyncConfig, SQLAlchemyPlugin, SQLAlchemySyncConfig
from advanced_alchemy.extensions.litestar.alembic import AlembicCommands
from advanced_alchemy.extensions.litestar.plugins import SQLAlchemyPlugin
from advanced_alchemy.extensions.litestar.plugins.init.config.asyncio import SQLAlchemyAsyncConfig
from advanced_alchemy.extensions.litestar.plugins.init.config.sync import SQLAlchemySyncConfig


@pytest.fixture(autouse=True)
def reload_package() -> Generator[None, None, None]:
yield
GenericSQLAlchemyConfig._KEY_REGISTRY = set()


@pytest.fixture(autouse=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def test_create_all_default(monkeypatch: MonkeyPatch) -> None:
config,
"create_all_metadata",
) as create_all_metadata_mock:
async with LifespanManager(app): # pyright: ignore[reportArgumentType]
async with LifespanManager(app): # type: ignore[arg-type] # pyright: ignore[reportArgumentType]
create_all_metadata_mock.assert_not_called()


Expand All @@ -90,7 +90,7 @@ async def test_create_all(monkeypatch: MonkeyPatch) -> None:
config,
"create_all_metadata",
) as create_all_metadata_mock:
async with LifespanManager(app): # pyright: ignore[reportArgumentType]
async with LifespanManager(app): # type: ignore[arg-type] # pyright: ignore[reportArgumentType]
create_all_metadata_mock.assert_called_once()


Expand Down

0 comments on commit ac908a4

Please sign in to comment.