[issue15323] Provide target name in output message when Mock.assert_called_once_with fails

2012-09-28 Thread Michael Foord
Michael Foord added the comment: Eric: yes, patch sets the name on the mock objects it creates. A mock only knows its direct name, not its full 'dotted' name (i.e. a mock knows it is called 'time' but not that it is 'time.time'). It is possible (but harder) to deduce that name (follow the chai

[issue15323] Provide target name in output message when Mock.assert_called_once_with fails

2012-09-28 Thread Éric Araujo
Éric Araujo added the comment: Cool change. I assume when you use mock.patch as decorator the mock name is set to the mocked object? -- ___ Python tracker ___ _

[issue15323] Provide target name in output message when Mock.assert_called_once_with fails

2012-09-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset 70d43fedb2d7 by Michael Foord in branch 'default': Closes issue 15323. Improve failure message of Mock.assert_called_once_with http://hg.python.org/cpython/rev/70d43fedb2d7 -- nosy: +python-dev resolution: -> fixed stage: -> committed/reje

[issue15323] Provide target name in output message when Mock.assert_called_once_with fails

2012-09-28 Thread Arnav Khare
Arnav Khare added the comment: Added a test to the patch supplied. -- nosy: +Arnav.Khare Added file: http://bugs.python.org/file27335/mock_assert_called_once_with_output_update_including_test.patch ___ Python tracker

[issue15323] Provide target name in output message when Mock.assert_called_once_with fails

2012-07-14 Thread Éric Araujo
Éric Araujo added the comment: Nice idea! A small question: Why print 'time' in the message and not 'time.time'? -- nosy: +eric.araujo ___ Python tracker ___ _

[issue15323] Provide target name in output message when Mock.assert_called_once_with fails

2012-07-11 Thread Michael Foord
Michael Foord added the comment: Looks good, thanks. -- assignee: -> michael.foord nosy: +michael.foord ___ Python tracker ___ ___ P

[issue15323] Provide target name in output message when Mock.assert_called_once_with fails

2012-07-10 Thread Chris Jerdonek
Chris Jerdonek added the comment: I have a minor suggestion. I would suggest-- + msg = ("Expected %s to be called once. Called %s times." % +(repr(self._mock_name) or 'mock', self.call_count)) so that one can distinguish between self._mock_name not being defined and self._mock_name b

[issue15323] Provide target name in output message when Mock.assert_called_once_with fails

2012-07-10 Thread Brian Jones
New submission from Brian Jones : In Python 3.3.0b1, if the number of calls to a mock is, say, zero, and you call assert_called_once_with() on that mock, it will throw an exception which says "Expected to be called once. Called 0 times." This is nice, but it would be nicer if the output messag