[issue43478] Disallow Mock spec arguments from being Mocks

2022-02-02 Thread Matthew Suozzo
Change by Matthew Suozzo : -- pull_requests: +29275 pull_request: https://github.com/python/cpython/pull/31090 ___ Python tracker ___

[issue43478] Disallow Mock spec arguments from being Mocks

2021-04-10 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +vstinner nosy_count: 9.0 -> 10.0 pull_requests: +24071 pull_request: https://github.com/python/cpython/pull/25227 ___ Python tracker ___

[issue43478] Disallow Mock spec arguments from being Mocks

2021-04-10 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 6e468cb16bde483ad73c1eb13b20a08d74e30846 by Pablo Galindo in branch 'master': bpo-43478: Fix formatting of NEWS entry (GH-25335) https://github.com/python/cpython/commit/6e468cb16bde483ad73c1eb13b20a08d74e30846 --

[issue43478] Disallow Mock spec arguments from being Mocks

2021-04-10 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- nosy: +pablogsal nosy_count: 8.0 -> 9.0 pull_requests: +24069 pull_request: https://github.com/python/cpython/pull/25335 ___ Python tracker

[issue43478] Disallow Mock spec arguments from being Mocks

2021-04-10 Thread Shreyan Avigyan
Change by Shreyan Avigyan : -- nosy: -shreyanavigyan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43478] Disallow Mock spec arguments from being Mocks

2021-04-10 Thread Shreyan Avigyan
Change by Shreyan Avigyan : -- pull_requests: -24064 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43478] Disallow Mock spec arguments from being Mocks

2021-04-10 Thread Shreyan Avigyan
Change by Shreyan Avigyan : -- nosy: +shreyanavigyan nosy_count: 8.0 -> 9.0 pull_requests: +24064 pull_request: https://github.com/python/cpython/pull/25207 ___ Python tracker

[issue43478] Disallow Mock spec arguments from being Mocks

2021-04-09 Thread Gregory P. Smith
Gregory P. Smith added the comment: New changeset dccdc500f9b5dab0a20407ae0178d393796a8828 by Matthew Suozzo in branch 'master': bpo-43478: Restrict use of Mock objects as specs (GH-25326) https://github.com/python/cpython/commit/dccdc500f9b5dab0a20407ae0178d393796a8828 --

[issue43478] Disallow Mock spec arguments from being Mocks

2021-04-09 Thread Matthew Suozzo
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

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-16 Thread Matthew Suozzo
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 --

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-16 Thread Matthew Suozzo
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 factor

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: The tests can be fixed. The change to raise exception can be merged to gather feedback during alpha/beta and see if there are any valid usecases. -- ___ Python tracker

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Matthew Suozzo
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

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Chris Withers
Chris Withers added the comment: I agree that this should raise an exception. Can the two failing tests in mock's own suite be easily fixed? -- ___ Python tracker ___

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: For a simple experiment raising an exception I can see two tests failing in test suite that have the pattern of having an autospec which is a mock object. diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 720f682efb..d33c7899a1 100644

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +cjw296, lisroach, mariocj89, michael.foord ___ Python tracker ___ ___

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Gregory P. Smith
Gregory P. Smith added the comment: Lets go ahead and try making this a breaking change in 3.10. If users report it causes a bunch of problems during the beta -that they don't want to address so soon- (they are all likely bugs in test suites...) we can soften it to a warning for a cycle.

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Gregory P. Smith
Change by Gregory P. Smith : -- nosy: +gregory.p.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-11 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-11 Thread Matthew Suozzo
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