Skip to content

Commit 20ccaaa

Browse files
committed
ISPyB tables are specifically 'sqlalchemy.orm.Session' objects; indicate so
1 parent 464b32e commit 20ccaaa

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tests/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import pytest
88
from ispyb.sqlalchemy import BLSession, Person, Proposal, url
99
from sqlalchemy import create_engine
10+
from sqlalchemy.orm import Session as SQLAlchemySession
1011
from sqlalchemy.orm import scoped_session, sessionmaker
11-
from sqlmodel import Session
1212

1313
from murfey.util.db import Session as MurfeySession
1414
from murfey.util.db import clear, setup
@@ -123,9 +123,9 @@ def ispyb_session_factory(ispyb_engine):
123123

124124

125125
@pytest.fixture
126-
def ispyb_db(ispyb_session_factory) -> Generator[Session, None, None]:
126+
def ispyb_db(ispyb_session_factory) -> Generator[SQLAlchemySession, None, None]:
127127
# Get a new session from the session factory
128-
ispyb_db: Session = ispyb_session_factory()
128+
ispyb_db: SQLAlchemySession = ispyb_session_factory()
129129

130130
# Populate the ISPyB table with some default values
131131
person_db_entry = Person(
@@ -173,6 +173,6 @@ def start_postgres():
173173
setup(murfey_db_url)
174174

175175
murfey_session = MurfeySession(id=2, name="cm12345-6")
176-
with Session(murfey_db_engine) as murfey_db:
176+
with SQLAlchemySession(murfey_db_engine) as murfey_db:
177177
murfey_db.add(murfey_session)
178178
murfey_db.commit()

tests/server/test_ispyb.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from ispyb.sqlalchemy import BLSession, Proposal
2-
from sqlmodel import Session, select
2+
from sqlalchemy import select
3+
from sqlalchemy.orm import Session
34

45
from murfey.server.ispyb import get_session_id
56
from tests.conftest import ExampleVisit
@@ -10,7 +11,7 @@ def test_get_session_id(
1011
):
1112
# Manually get the BLSession ID for comparison
1213
query = (
13-
ispyb_db.exec(
14+
ispyb_db.execute(
1415
select(BLSession)
1516
.join(Proposal)
1617
.where(BLSession.proposalId == Proposal.proposalId)

0 commit comments

Comments
 (0)