Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.8k
✅ Fix incorrect mocking in unit tests (issue #1780)#1781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Conversation
YuriiMotov left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
I suggest removing several lines to simplify tests (I tested it locally - it doesn't break tests).
Currently if you replacesession.exec(select(1)) inthis line withpass,this assertion will not fail as it's expected.
This PR fixes mocking theSession and after applying it, that test will not only ensure that there was no exception ininit, but also thatselect(1) was actually called.
@vicaya, thank you!Could you please take a look at my suggested changes? (done)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
daa3017 to5321f5bComparetiangolo commentedSep 20, 2025
It seems we now have some conflicts here 🤔 😔 |
This pull request has a merge conflict that needs to be resolved. |
Uh oh!
There was an error while loading.Please reload this page.
Fix issue#1780: the 2
test_init_successful_connectiontests were basically noops due to misuse of MagicMock.The errors went undetected until python 3.12+ tightened up the MagicMock implementation.