[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread Gregory P. Smith
Gregory P. Smith added the comment: i believe the issues surfaces in this are fixed at this point. of note, my mock_call_test.py example now passes. i'm not entirely sure that it _should_ pass though, but that depends on what we want create_autospec of a class to do. should that autospec'd

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread Gregory P. Smith
Gregory P. Smith added the comment: New changeset 4042e1afd252858de53e2b79d946a51a0182d1ba by Gregory P. Smith in branch '3.7': [3.7] bpo-36871: Handle spec errors in assert_has_calls (GH-16364) (GH-16374) https://github.com/python/cpython/commit/4042e1afd252858de53e2b79d946a51a0182d1ba ---

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread Gregory P. Smith
Change by Gregory P. Smith : -- pull_requests: +15954 pull_request: https://github.com/python/cpython/pull/16374 ___ Python tracker ___

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread miss-islington
Change by miss-islington : -- pull_requests: +15952 pull_request: https://github.com/python/cpython/pull/16372 ___ Python tracker ___ __

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread miss-islington
Change by miss-islington : -- pull_requests: +15951 pull_request: https://github.com/python/cpython/pull/16371 ___ Python tracker ___ __

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread miss-islington
miss-islington added the comment: New changeset 1a17a054f6314ce29cd2632c28aeed317a615360 by Miss Islington (bot) in branch '3.8': [3.8] bpo-36871: Handle spec errors in assert_has_calls (GH-16005) (GH-16364) https://github.com/python/cpython/commit/1a17a054f6314ce29cd2632c28aeed317a615360 -

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread miss-islington
Change by miss-islington : -- pull_requests: +15944 pull_request: https://github.com/python/cpython/pull/16364 ___ Python tracker ___ __

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread Gregory P. Smith
Gregory P. Smith added the comment: New changeset 2180f6b058effbf49ec819f7cedbe76ddd4b700c by Gregory P. Smith (Samuel Freilich) in branch 'master': bpo-36871: Avoid duplicated 'Actual:' in assertion message (GH-16361) https://github.com/python/cpython/commit/2180f6b058effbf49ec819f7cedbe76dd

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread Samuel Freilich
Change by Samuel Freilich : -- keywords: +patch pull_requests: +15942 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/16361 ___ Python tracker _

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-24 Thread miss-islington
miss-islington added the comment: New changeset b5a7a4f0c20717a4c92c371583b5521b83f40f32 by Miss Islington (bot) (Samuel Freilich) in branch 'master': bpo-36871: Handle spec errors in assert_has_calls (GH-16005) https://github.com/python/cpython/commit/b5a7a4f0c20717a4c92c371583b5521b83f40f32

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-12 Thread Michael Foord
Michael Foord added the comment: (The code that generated functions was originally borrowed from the decorator module by Michele Simionato. When I first started in Python, around 2002, I was impressed by the Python community as it had two very prominent women amongst the part of the communit

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-12 Thread Samuel Freilich
Samuel Freilich added the comment: Check out my PR, which solves a much smaller issue: It fixes a bug in the exception raising logic in assert_has_calls (and _awaits) which makes complicated problems like the one you mention much harder to debug. Also it has tests! -- _

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-12 Thread Michael Foord
Michael Foord added the comment: The code around whether or not to swallow self is hairy. Even if the original spec object is a class we may still be mocking an instance of the class (we don't want users to have to create an instance just to be able to use it as a spec). So we have to carry

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-12 Thread Gregory P. Smith
Gregory P. Smith added the comment: i reopened this without diving into the code to better understand based on Samuels comment. We could really do with a testcase that demonstrates the misleading error message problem for some test driven development here. -- keywords: -patch stage

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-12 Thread Gregory P. Smith
Change by Gregory P. Smith : -- resolution: fixed -> stage: resolved -> needs patch status: closed -> open ___ Python tracker ___ _

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-12 Thread Gregory P. Smith
Change by Gregory P. Smith : -- assignee: -> michael.foord ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-11 Thread Samuel Freilich
Samuel Freilich added the comment: Sure, but the bug in error-handling should still be fixed. Currently, if _call_matcher returns an exception, that's ignored by assert_has_calls, and the error message generated as a result is extremely misleading! -- ___

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: It was a conscious decision over not to do the proposed change in the issue. There are other issues over signature difference during construction of mock and in the call_matcher over presence/absence of self. It needs a more careful fix. -

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-11 Thread Samuel Freilich
Change by Samuel Freilich : -- pull_requests: +15630 pull_request: https://github.com/python/cpython/pull/16005 ___ Python tracker ___ _

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-09-11 Thread Samuel Freilich
Samuel Freilich added the comment: This is still not totally fixed. This solves the underlying error with method specs, but not the bug that was causing the error-swallowing in assert_has_calls: https://github.com/python/cpython/blob/ee536b2020b1f0baad1286dbd4345e13870324af/Lib/unittest/mock

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-29 Thread Ned Deily
Change by Ned Deily : -- versions: +Python 3.9 -Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-29 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Closing this as fixed since all PRs are merged. Thank you all :) -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-28 Thread Chris Withers
Chris Withers added the comment: New changeset 38d311d79e57479f7a684c2cd298293033dc4990 by Chris Withers (Miss Islington (bot)) in branch '3.8': bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH15578) https://github.com/python/cpython/commit/38d311d79e57479

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-28 Thread Chris Withers
Chris Withers added the comment: New changeset be310e03d0b84ef56e9d35b0b1b21d685b7ea371 by Chris Withers (Miss Islington (bot)) in branch '3.7': bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH15577) https://github.com/python/cpython/commit/be310e03d0b84ef

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-28 Thread miss-islington
Change by miss-islington : -- pull_requests: +15254 pull_request: https://github.com/python/cpython/pull/15578 ___ Python tracker ___ __

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-28 Thread miss-islington
Change by miss-islington : -- pull_requests: +15253 pull_request: https://github.com/python/cpython/pull/15577 ___ Python tracker ___ __

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-08-28 Thread Chris Withers
Chris Withers added the comment: New changeset c96127821ebda50760e788b1213975a0d5bea37f by Chris Withers (Xtreak) in branch 'master': bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH13261) https://github.com/python/cpython/commit/c96127821ebda50760e788b121

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-05-12 Thread Cheryl Sabella
Change by Cheryl Sabella : -- nosy: +lisroach ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-05-12 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I have created a PR for this. My approach is that when mock_thing.assert_has_calls(mock.call.method1(1, 2)) is made the assert_has_calls is made against mock_thing whose spec_signature (constructor signature) is always used. But there is _mock_chil

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-05-12 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- keywords: +patch pull_requests: +13171 stage: needs patch -> patch review ___ Python tracker ___ ___

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-05-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: This is little tricky to fix since the call-matcher needs the signature and also the information over whether to add self or not for some cases. Similar open issues. https://bugs.python.org/issue27715 https://bugs.python.org/issue26752 An approach

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-05-09 Thread Gregory P. Smith
Gregory P. Smith added the comment: If you use a debugger on this, you'll discover that what is happening inside of mock's assert_has_calls is that it is catching and swallowing an exception around the inspect.Signature instances bind() call complaining about 'b' being an unexpected keyword

[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-05-09 Thread Gregory P. Smith
New submission from Gregory P. Smith : Thing: mock_thing.method sig=(a=None, b=0) F == FAIL: test_has_calls_on_thing (__main__.MockCallTest) -- Traceback (most