You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FWIW, I have just opened python/typeshed#4275. This will add stubs to typeshed for now. Of course, I'd be glad to see the stubs in pytest-mock directly some day, either via separate stub files or inline.
Activity
nicoddemus commentedon Aug 2, 2019
Thanks for the suggestion @chdsbd. I think this would be best when
pytest-mocksupports Python 3 only so we can use native type annotations.JakeSummers commentedon Apr 2, 2020
There are some reasonable workarounds to this problem.
Right now I have a test like this:
When I run it through mypy, I get the following error:
Workaround #1 - Ignore the error
Workaround #2 - Use the result of the patch command.
srittau commentedon Jun 26, 2020
FWIW, I have just opened python/typeshed#4275. This will add stubs to typeshed for now. Of course, I'd be glad to see the stubs in pytest-mock directly some day, either via separate stub files or inline.
bluetech commentedon Jun 26, 2020
@srittau What gets priority when a package has its own stubs, and is also defined in typeshed?
JelleZijlstra commentedon Jun 28, 2020
@bluetech stub packages get priority, see https://www.python.org/dev/peps/pep-0561/#type-checker-module-resolution-order.
bluetech commentedon Jun 28, 2020
Thanks @JelleZijlstra. So it should be fine if we ever decide to ship type annotations inline.
srittau commentedon Jun 28, 2020
As soon as that happens, we should remove the stubs from typeshed anyway, to avoid confusion and reduce typeshed's maintenance burden.
jtpavlock commentedon Aug 6, 2020
Pytest 6.0 now supports type annotations and pytest-mock is now python3.5+ 👀
nicoddemus commentedon Aug 6, 2020
In #194 we now run
mypywithout errors onpytest-mockitself (thanks to @staticdev), so at least that step is done.The next step would probably be to type annotate the public API and export a
py.typedfile along the package.ref(mypy): don't ignore missing imports by default
ref(mypy): don't ignore missing imports by default (#486)
Full type annotations
Remove pytest_mock
Remove pytest_mock (#4478)