Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test calling called_once_with() instead of assert_called_once_with(). #2486

Merged
merged 1 commit into from
Dec 28, 2023

Conversation

carlosperate
Copy link
Member

A MagicMock object was being asserted with called_once_with() instead of assert_called_once_with(), likely an accidental mistake.

As a MagicMock always returns another instance of MagicMock on anything not previoysly set up, the assert was always passing, even though we updated the Window.connect_zoom() implementation and these asserts should be failing.

I only noticed this because in Python 3.12 this type of typo is caught and throws an exception.

A MagicMock object was being asserted with 'called_once_with()'
instead of 'assert_called_once_with()', likely an accidental
mistake.

As a MagicMock always returns another instance of MagicMock on
anything not previoysly set up, the `assert` was always passing,
even though we updated the Window.connect_zoom() implementation
and that should have failed.

In Python 3.12 this type of typo is caught and throws an exception.
@carlosperate carlosperate changed the title tests: Fix 'called_once_with' used instead of 'assert_called_once_with'. Fix test calling called_once_with() instead of assert_called_once_with(). Dec 27, 2023
Copy link
Member Author

@carlosperate carlosperate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI issue is not related to this PR, and the change is very small, so I'll merge this to unblock work on Python 3.12 from other branches.

@carlosperate carlosperate merged commit 8fb168a into master Dec 28, 2023
57 of 58 checks passed
@carlosperate carlosperate deleted the mock-fix branch December 28, 2023 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant