[issue17015] mock could be smarter and inspect the spec's signature

2013-02-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: Committed! -- resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker ___

[issue17015] mock could be smarter and inspect the spec's signature

2013-02-02 Thread Roundup Robot
Roundup Robot added the comment: New changeset b888c9043566 by Antoine Pitrou in branch 'default': Issue #17015: When it has a spec, a Mock object now inspects its signature when matching calls, so that arguments can be matched positionally or by name. http://hg.python.org/cpython/rev/b888c90435

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-30 Thread Michael Foord
Michael Foord added the comment: Ah, well if the bugfix exists everywhere that function signatures exist then it shouldn't be a problem. (I think there is already a backport of inspect.signature() by Nick Coghlan.) -- ___ Python tracker

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I am a little concerned that this relies on Python 3 only features of > inspect, and *in fact* relies on bug fixes in Python 3.4 to work. The bug fix has landed in 3.3 as well ;-) (see 49fd1c8aeca5) I guess a backport of inspect.signature() would allow it to w

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-30 Thread Michael Foord
Michael Foord added the comment: Wow, impressive work Antoine - thanks. I am a little concerned that this relies on Python 3 only features of inspect, and *in fact* relies on bug fixes in Python 3.4 to work. That means it would be hard / impossible for the backport "mock" to have the new featu

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a new patch, making all assert_*_call methods work as well as autospeccing, and adding tests. Not sure I'm forgetting something else. -- Added file: http://bugs.python.org/file28903/issue17015-3.patch ___ Pyt

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-29 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- dependencies: +Signature.bind() fails with a keyword argument named "self" ___ Python tracker ___ ___ P

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Proof-of-concept patch. mock is ugly! -- keywords: +patch Added file: http://bugs.python.org/file28886/issue17015.patch ___ Python tracker ___ _

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-25 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-22 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: (note: also fails if I use `mock = Mock(wraps=f)` instead of `mock = Mock(spec=f)`) -- ___ Python tracker ___ _

[issue17015] mock could be smarter and inspect the spec's signature

2013-01-22 Thread Antoine Pitrou
New submission from Antoine Pitrou: This is a bit annoying: >>> def f(a, b): pass ... >>> mock = Mock(spec=f) >>> mock(1, 2) >>> mock.assert_called_with(1, 2) >>> mock.assert_called_with(a=1, b=2) Traceback (most recent call last): File "", line 1, in File "/home/antoine/cpython/default/L