-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Get mock coverage back to 100% #18228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…to ever be exectuted.
The assertion makes sure this continues to be the case!
Before this change, the stop-without-start blows up with `TypeError: 'NoneType' object is not iterable`
|
Now that https://bugs.python.org/issue39485 is resolved, this PR is the last blocker for the 4.0 release of the backport. Since there have been no complaints, I'm going to go ahead and merge it. |
|
|
It's not clear to me what's actually failed in the buildbot above? Anyone able to enlighten me? |
* use the `: pass` and `: yield` patterns for code that isn't expected to ever be executed. * The _Call items passed to _AnyComparer are only ever of length two, so assert instead of if/else * fix typo * Fix bug, where stop-without-start patching dict blows up with `TypeError: 'NoneType' object is not iterable`, highlighted by lack of coverage of an except branch. * The fix for bpo-37972 means _Call.count and _Call.index are no longer needed. * add coverage for calling next() on a mock_open with readline.return_value set. * __aiter__ is defined on the Mock so the one on _AsyncIterator is never called.
|
@cjw296 From what I can tell, it looks like it occurred from (which resulted in Perhaps there's some form of intermittent failure present there, but it will likely require further investigation. Is this worth opening a bpo issue for, @vstinner? |
|
Yeah, I'm fairly sure I had this test fail when I merged to master a while back: |
|
I suggest to comment https://bugs.python.org/issue39088. |
I wish there was a way to enforce coverage on mock in cpython, it's so easy to slip and always introduces dead code, at best, and bugs at worst.
I'm neutral on whether or not this should be backported to 3.8 or 3.7, however I would like to land this soon as possible so we can get mock 4.0 out and get a lot more feedback on all the AsyncMock stuff :-)