Change by Matthew Suozzo :
--
pull_requests: +29275
pull_request: https://github.com/python/cpython/pull/31090
___
Python tracker
<https://bugs.python.org/issue43
New submission from Matthew Suozzo :
An unfortunately common pattern over large codebases of Python tests is for
spec'd Mock instances to be provided with Mock objects as their specs. This
gives the false sense that a spec constraint is being applied when, in fact,
nothing will be disal
Matthew Suozzo added the comment:
I've fixed a bunch of these in our internal repo so I'd be happy to add that to
a patch implementing raising exceptions for these cases.
--
___
Python tracker
<https://bugs.python.o
Matthew Suozzo added the comment:
A few more things:
Assertions on Mock-autospec'ed Mocks will silently pass since e.g.
assert_called_once_with will now be mocked out. This may justify a more
stringent stance on the pattern since it risks hiding real test failures.
One complicating f
Matthew Suozzo added the comment:
And to give some context for the above autospec child bit, this is the relevant
code that determines the spec to use for each child:
https://github.com/python/cpython/blob/master/Lib/unittest/mock.py#L2671-L2696
New submission from Matthew Suozzo :
Given the increasing use of long `from typing import foo, bar, ...` import
sequences, it's becoming more desirable to address individual components of the
import node. Unfortunately, the ast.alias node doesn't contain source location
metadata (e
Change by Matthew Suozzo :
--
keywords: +patch
pull_requests: +24059
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25324
___
Python tracker
<https://bugs.python.org/issu
Matthew Suozzo added the comment:
Ah and one other question: Is this normally the sort of thing that would get
backported? It should be very straightforward to do so, at least for 3.9 given
the support for the new parser.
--
versions: -Python 3.6, Python 3.7, Python 3.8
Change by Matthew Suozzo :
--
keywords: +patch
nosy: +matthew.suozzo
nosy_count: 7.0 -> 8.0
pull_requests: +24061
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25326
___
Python tracker
<https://bugs.p
Matthew Suozzo added the comment:
I don't think this was actually fixed for the create_autospec case.
create_autospec still uses the only is_async_func check to enable use of
AsyncMock and that still does a __code__ check.
There was a test submitted to check this case but the test i
Change by Matthew Suozzo :
--
pull_requests: +24081
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/25347
___
Python tracker
<https://bugs.python.org/issu
New submission from Matthew Suozzo :
# Issue
When profiling a generator function, the initial call and all subsequent yields
are aggregated into the same "ncalls" metric by cProfile.
## Example
>>> cProfile.run("""
... def foo():
... yield 1
... yield
Matthew Suozzo added the comment:
One of the problems with my proposed solution that I glossed over was how and
where to count the primitive call. If the primitive call is only registered on
RETURN (i.e. after all yields), a generator that is incompletely exhausted
would have 0 primitive
Matthew Suozzo added the comment:
> It just won't work unless you add explicit ".*" or ".*?" at the start of the
> pattern
But think of when regexes are used for validating input. Getting it to "just
work" may be over-permissive validation that o
14 matches
Mail list logo