Skip to content

Commit 03ae994

Browse files
committed
fix CI issues
1 parent f09f7d1 commit 03ae994

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ repos:
3737
hooks:
3838
- id: ty-check
3939
name: ty-check
40-
language: python
40+
language: system
4141
entry: ty check
4242
pass_filenames: false
43-
additional_dependencies: [ty==0.0.34]
4443

4544
- repo: https://github.com/asottile/blacken-docs
4645
rev: 1.20.0

tests/conftest.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,27 @@ async def generate_postgres_container() -> AsyncGenerator[DBBuilder]:
118118

119119

120120
# ------------------ Session fixtures -------------------
121+
@pytest.fixture(name="session_maker", scope="session")
122+
def get_session_maker(db_builder: DBBuilder) -> async_sessionmaker[AsyncSession]:
123+
"""Return a single session-scoped async session maker (one engine for the whole run)."""
124+
return _make_session(db_builder)
125+
126+
121127
@pytest.fixture(name="db_session")
122-
async def get_db_session(db_builder: DBBuilder) -> AsyncGenerator[AsyncSession]:
128+
async def get_db_session(
129+
session_maker: async_sessionmaker[AsyncSession],
130+
) -> AsyncGenerator[AsyncSession]:
123131
"""Return the test db session."""
124-
async_session = _make_session(db_builder)
125-
async with async_session() as session:
132+
async with session_maker() as session:
126133
yield session
127134

128135

129136
@pytest.fixture(name="db_session_module", scope="module")
130-
async def get_db_session_module(db_builder: DBBuilder) -> AsyncGenerator[AsyncSession]:
137+
async def get_db_session_module(
138+
session_maker: async_sessionmaker[AsyncSession],
139+
) -> AsyncGenerator[AsyncSession]:
131140
"""Return the test db session."""
132-
async_session = _make_session(db_builder)
133-
async with async_session() as session:
141+
async with session_maker() as session:
134142
yield session
135143

136144

@@ -176,13 +184,9 @@ async def _clean_db_module(
176184
# Helper functions
177185
# -------------------------------------------------------
178186
def _make_session(db_builder: DBBuilder) -> async_sessionmaker[AsyncSession]:
179-
"""Create a new async session."""
187+
"""Create a new async session maker backed by a single engine."""
180188
connection_string = db_builder.get_connection_string()
181-
db_echo: bool = False
182-
db_pool_size: int = 5
183-
engine = get_engine(
184-
new=True, connection_string=connection_string, echo=db_echo, pool_size=db_pool_size
185-
)
189+
engine = get_engine(new=True, connection_string=connection_string, echo=False, pool_size=5)
186190
return async_sessionmaker(engine, expire_on_commit=False)
187191

188192

ty.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# ty.toml: ty type checker configuration
22
# Reference: https://docs.astral.sh/ty/reference/configuration/
33
[environment]
4-
python = "./venv"
54
python-version = "3.14"
65

76

0 commit comments

Comments
 (0)