Skip to content

responses 0.21.0 broke mypy check #556

@ondratu

Description

@ondratu

Describe the bug

We use response in our tests, and from responses 0.21.0 we've got this error:

$mypy tests/test_download.py 
venv/lib/python3.10/site-packages/mypy/typeshed/stdlib/unittest/mock.pyi: error: Source file found twice under different module names: "unittest.mock" and "mypy.typeshed.stdlib.unittest.mock"
Found 1 error in 1 file (errors prevented further checking)

Returning mypy version did not resolve problem, but returning responses to 0.20.0 does.

I try to find problem in your changes, and it could be probably this line in init.py:

from mypy.typeshed.stdlib.unittest.mock import _patcher as _mock_patcher

Additional context

No response

Version of responses

0.21.0

Steps to Reproduce

# content of crash.py

import responses
import unittest.mock

and than run

mypy crash.py

Expected Result

Success: no issues found in 1 source file

Actual Result

venv/lib/python3.10/site-packages/mypy/typeshed/stdlib/unittest/mock.pyi: error: Source file found twice under different module names: "unittest.mock" and "mypy.typeshed.stdlib.unittest.mock"
Found 1 error in 1 file (errors prevented further checking)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions