question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

responses 0.21.0 broke mypy check

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:6
  • Comments:19 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
ancalitacommented, Jul 6, 2022

@markstory Experiencing the same issue when trying to upgrade responses in a Rasa private repo - could you please let us know about timeline for a new release (micro or minor) now that the PR with the fix got merged?

2reactions
fredrikaverpilcommented, Aug 23, 2022

@beliaev-maksim

$ mypy --version
mypy 0.971 (compiled: yes)

With responses = {git = "https://github.com/getsentry/responses.git", rev = "master"} in pyproject.toml:

$ poetry update responses 
Updating dependencies
Resolving dependencies... (17.8s)

Writing lock file

Package operations: 0 installs, 1 update, 0 removals

  • Updating responses (0.20.0 -> 0.21.0 1db612d)
$ mypy
Success: no issues found in 232 source files

Looks like it’s fixed in master! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common issues and solutions - mypy 0.991 documentation
Common issues and solutions# · Can't install mypy using pip# · No errors reported for obviously wrong code# · Spurious errors and locally...
Read more >
httpx · PyPI
The 0.21.0 release integrates against a newly redesigned httpcore backend. ... The response.has_redirect_location location may be used to determine ...
Read more >
Release Notes - FastAPI - tiangolo
Upgrade mypy and tweak internal type annotations. PR #5398 by @tiangolo. Update test dependencies, upgrade Pytest, move dependencies from dev to test.
Read more >
Release Notes - Numba - PyData |
Leonardo Uieda fixed a broken link to the NumPy ufunc signature docs in #5963. Lucio Fernandez-Arjona added mypy to CI and started adding...
Read more >
What's New - Xarray
Added test for DataArray attrs deepcopy recursion/nested attrs. ... Fix Mapping argument typing to allow mypy to pass on str keys (PR5690).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found