Skip to content

Consider marking UP026's fix unsafe #22343

@robsdedude

Description

@robsdedude

Summary

I'll quote the readme of the mock package:

mock is now part of the Python standard library, available as unittest.mock in Python 3.3 onwards.

This package contains a rolling backport of the standard library mock code compatible with Python 3.6 and up.

So replacing import mock with from unittest import mock is not equivalent given a code-base that's on an old-ish Python version but want to use new features of mock and therefore decides to use the stand-alone package. Arguably, such code-base should be disabling the lint, nonetheless does the fix cause a little mayhem first should the rule be enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions