Comments (5)
To be clear: I think shipping separate stubs is a really bad idea for any python package, and I was strongly against that part of the PEP. They will invariably get out of date and cause more problems than they solve.
from mock.
Hi! I think the right way to do this would be to just add the type annotations you need upstream (ie: as a CPython PR) and then they will flow down to the backport here.
If you create such a PR, feel free to link it from this issue.
from mock.
Thanks @cjw296. There are stubs specifically for this package here, but they had the same type checks as the stdlib version here. I have just had a PR merged to fix this.
from mock.
You're missing my point: there's no need for separate type stubs, please add typing information you need as a PR to the actual code upstream, so that no separate stubs are needed.
(Unless I'm missing something: my understanding is that type stubs were only intended to be a stop-gap until the source code could have type annotations added to it, if you know different, please explain it to me!)
Also, your link to https://github.com/python/typeshed/blob/master/stubs/mock/mock.pyi
gives me a 404.
from mock.
Sorry, I fixed the link.
What I mean is the stubs already existed and needed a small fix to solve the problem. I was wondering why the type annotations aren't already added to cpython, as it is much better for developing against. I am interested in doing that, but it will require significantly more effort and probably be a more drawn out review process to make sure nothing is broken.
from mock.
Related Issues (20)
- should we mark as deprecated? HOT 3
- Add assert_not_called_with HOT 1
- Version 4.0 release HOT 3
- Syntax Error in 4.0.0 HOT 3
- Mock 4.0.0 "missing X positional argument" on instantiation of objects inherited from mock.MagicMock HOT 7
- Please add contribution guidelines HOT 1
- Should the backports follow upstream releases? instead of alpha/beta/rcs. HOT 3
- Remove universal wheel tag and hide 4.0.0b1 and 4.0.0 releases to stop tools finding them. HOT 14
- egg_info for package mock produced metadata for project name unknown HOT 5
- 4.0.x: 'ValueError: Sentinels must not start with _' and others HOT 7
- Can we get mock supported in python 3.8 HOT 2
- Can no longer patch flask.g HOT 9
- spec_set/autospec/spec seems to not be reading attributes defined in class body HOT 2
- mock throws ValueError when spec_arg is an ndarray HOT 4
- Question on release 4.0.3 HOT 2
- Test test_bool_not_called_when_passing_spec_arg() fails (mixup unittest.mock vs mock?) HOT 4
- 4.0.3: pytest is failing HOT 5
- Error when inspecting the signature of AsyncMock() HOT 6
- Unclear error mocking a class and asserting called with HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mock.