Skip to content

Commit 1d9bbc7

Browse files
committed
Tried different way of mocking the main 'ISPyBSession' object
1 parent fc0a910 commit 1d9bbc7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/workflows/clem/test_register_preprocessing_results.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,12 @@ def test_run_with_db(
188188
mock_get_security_config = mocker.patch("murfey.server.ispyb.get_security_config")
189189
mock_get_security_config.return_value = mock_security_config
190190

191-
mock_ispyb_sessionmaker = mocker.patch("murfey.server.ispyb.sessionmaker")
192-
mock_ispyb_sessionmaker.return_value.return_value = ispyb_db_session
191+
mock_ispyb_session_factory = MagicMock(return_value=ispyb_db_session)
192+
mock_ispyb_session_factory.return_value = ispyb_db_session
193+
# mock_ispyb_sessionmaker = mocker.patch(
194+
mocker.patch(
195+
"murfey.server.ispyb.sessionmaker", return_value=mock_ispyb_session_factory
196+
)
193197

194198
# Mock the ISPYB connection when registering data collection group
195199
mocker.patch(

0 commit comments

Comments
 (0)