Skip to content

Use stdlib unittest.mock#1074

Open
gotmax23 wants to merge 2 commits into
dell:collectionsfrom
gotmax23:use-stdlib-mock
Open

Use stdlib unittest.mock#1074
gotmax23 wants to merge 2 commits into
dell:collectionsfrom
gotmax23:use-stdlib-mock

Conversation

@gotmax23

Copy link
Copy Markdown

Description

It is recommended to use unittest.mock from the standard library instead of the mock backport package which shouldn't be necessary with modern Python versions. It especially shouldn't be necessary to import both packages in the same file.

Downstreams like Fedora Linux are planning to remove the standalone mock package from the distribution (https://fedoraproject.org/wiki/Changes/DeprecatePythonMock) for this reason.

GitHub Issues

List the GitHub issues impacted by this PR:

GitHub Issue #

ISSUE TYPE

  • Test Pull Request
COMPONENT NAME

test

OUTPUT

ADDITIONAL INFORMATION

Checklist:

  • I have performed a self-review of my own code to ensure there are no formatting, vetting, linting, or security issues
  • I have verified that new and existing unit tests pass locally with my changes
  • I have not allowed coverage numbers to degenerate
  • I have maintained at least 90% code coverage
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have maintained backward compatibility

It is recommended to use unittest.mock from the standard library instead
of the mock backport package which shouldn't be necessary with modern
Python versions.
@ansible-collections-svc

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.54%. Comparing base (95a5900) to head (ab4a528).

Additional details and impacted files
@@               Coverage Diff               @@
##           collections    #1074      +/-   ##
===============================================
- Coverage        93.54%   93.54%   -0.01%     
===============================================
  Files              296      296              
  Lines            46333    46332       -1     
  Branches          4220     4220              
===============================================
- Hits             43340    43339       -1     
  Misses            1909     1909              
  Partials          1084     1084              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rounak-adhikary rounak-adhikary left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM since GHAs are passing.

@gotmax23
gotmax23 requested a review from rounak-adhikary May 16, 2026 00:13
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.

5 participants