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 assertions in test_git_hook #2196

Merged
merged 1 commit into from
Dec 4, 2023
Merged

Fix assertions in test_git_hook #2196

merged 1 commit into from
Dec 4, 2023

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Nov 6, 2023

Fix called_once() assertions in test_git_hook to use the correct assert_called_once() method. The former does not exist, so it evaluates to a mocked method in Python < 3.12, making the assert meaningless, and it triggers an error in Python 3.12+.

While at it, split the mock into two because otherwise the test would fail because two hooks.git_hook() calls imply two mock calls.

Fix `called_once()` assertions in `test_git_hook` to use the correct
`assert_called_once()` method.  The former does not exist, so it
evaluates to a mocked method in Python < 3.12, making the assert
meaningless, and it triggers an error in Python 3.12+.

While at it, split the mock into two because otherwise the test would
fail because two `hooks.git_hook()` calls imply two mock calls.
Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Merging #2196 (abfb91f) into main (14d0b36) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2196   +/-   ##
=======================================
  Coverage   99.22%   99.22%           
=======================================
  Files          38       38           
  Lines        3087     3087           
  Branches      747      747           
=======================================
  Hits         3063     3063           
  Misses         14       14           
  Partials       10       10           

Copy link
Collaborator

@staticdev staticdev left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @mgorny

@staticdev staticdev merged commit 96e2998 into PyCQA:main Dec 4, 2023
17 of 18 checks passed
@mgorny mgorny deleted the called-once branch December 4, 2023 18:36
@mgorny
Copy link
Contributor Author

mgorny commented Dec 4, 2023

Thanks!

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.

2 participants