You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If there is some query not terminated with one of the supported boundary functions, it appears the next query doesn't wort as expected
At this point rows_deleted_1 will be 0 and rows_deleted_1 will be 1
Expected behavior
The first delete should delete the row, not the second one.
Also, if the deletes above were replaced with .all() then the first .all() would return [] and the second would correctly return [db.TestTable(id=4, col1=2)].
Additional context
Looks to me like the mock_session's query gets mucked up by the update() call.
Obviously update() isn't testable with mock-alchemy so all I can do is check that update() is called with the correct arguments.
But not being able to test the sql query directly after an update leads to some gaps in my test coverage which aren't ideal. If it is something easily fixable I would appreciate this being looked at, but if not I'll just have to test that the delete is being called with the right arguments rather than checking that things get deleted.
The text was updated successfully, but these errors were encountered:
Agreed this is incorrect behavior. Ideally, any unknown call should not mess up the mock session. This is due to the way filter, query, etc. are handled, I will have to investigate more to find a better solution.
As a temporary solution, I can simply add update as an operation and make it not do anything. It seems if you call filter, query, etc. without a "terminating operation", this causes some strange issues. Let me if there other operators you would like as part of this list.
Describe the bug
If there is some query not terminated with one of the supported boundary functions, it appears the next query doesn't wort as expected
To Reproduce
At this point rows_deleted_1 will be 0 and rows_deleted_1 will be 1
Expected behavior
The first delete should delete the row, not the second one.
Also, if the deletes above were replaced with .all() then the first .all() would return [] and the second would correctly return [db.TestTable(id=4, col1=2)].
Additional context
Looks to me like the mock_session's query gets mucked up by the update() call.
Obviously update() isn't testable with mock-alchemy so all I can do is check that update() is called with the correct arguments.
But not being able to test the sql query directly after an update leads to some gaps in my test coverage which aren't ideal. If it is something easily fixable I would appreciate this being looked at, but if not I'll just have to test that the delete is being called with the right arguments rather than checking that things get deleted.
The text was updated successfully, but these errors were encountered: