Skip to content

Commit 464b32e

Browse files
committed
Add and commit tables one-by-one
1 parent 46c47a1 commit 464b32e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tests/conftest.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,25 +133,27 @@ def ispyb_db(ispyb_session_factory) -> Generator[Session, None, None]:
133133
familyName=ExampleVisit.family_name,
134134
login=ExampleVisit.login,
135135
)
136+
ispyb_db.add(person_db_entry)
137+
ispyb_db.commit()
138+
136139
proposal_db_entry = Proposal(
137140
personId=person_db_entry.personId,
138141
proposalCode=ExampleVisit.proposal_code,
139142
proposalNumber=str(ExampleVisit.proposal_number),
140143
)
144+
ispyb_db.add(proposal_db_entry)
145+
ispyb_db.commit()
146+
141147
bl_session_db_entry = BLSession(
142148
proposalId=proposal_db_entry.proposalId,
143149
beamLineName=ExampleVisit.instrument_name,
144150
visit_number=ExampleVisit.visit_number,
145151
)
146-
ispyb_db.add_all(
147-
[
148-
person_db_entry,
149-
proposal_db_entry,
150-
bl_session_db_entry,
151-
]
152-
)
152+
ispyb_db.add(bl_session_db_entry)
153153
ispyb_db.commit()
154-
yield ispyb_db # Yield the Session and pass processing over to other function
154+
155+
# Yield the Session and pass processing over to other function
156+
yield ispyb_db
155157

156158
# Tidying up
157159
ispyb_db.rollback()

0 commit comments

Comments
 (0)