summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/testmock/testhelpers.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-29403: Fix mock's broken autospec behavior on method-bound builtin ↵Aaron Gallagher2017-07-201-0/+15
| | | | | | | | | | | | | | | | | | | functions (GH-3) Cython will, in the right circumstances, offer a MethodType instance where im_func is a builtin function. Any instance of MethodType is automatically assumed to be a Python-defined function (more specifically, a function that has an inspectable signature), but _set_signature was still conservative in its assumptions. As a result _set_signature would return early with None instead of a mock since the im_func had no inspectable signature. This causes problems deeper inside mock, as _set_signature is assumed to _always_ return a mock, and nothing checked its return value. In similar corner cases, autospec will simply not check the spec of the function, so _set_signature is amended to now return early with the original, not-wrapped mock object. Patch by Aaron Gallagher.
* bpo-28961: Address my comments from earlier code review (#305)Berker Peksag2017-02-261-12/+3
|
* Fix unittest.mock._Call: don't ignore nameVictor Stinner2017-01-061-0/+14
| | | | | | | Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter anymore. Patch written by Jiajun Huang.
* Issue #26750: unittest.mock.create_autospec() now works properlyGregory P. Smith2016-08-071-21/+39
| | | | for subclasses of property() and other data descriptors.
* Issue #19594: Use specific asserts in unittest tests.Serhiy Storchaka2013-11-161-9/+9
|\
| * Issue #19594: Use specific asserts in unittest tests.Serhiy Storchaka2013-11-161-9/+9
| |
* | Issue #17015: When it has a spec, a Mock object now inspects its signature ↵Antoine Pitrou2013-02-021-20/+39
|/ | | | when matching calls, so that arguments can be matched positionally or by name.
* Fix exception when calling reset_mock on a mock created with autospecMichael Foord2012-06-091-0/+7
|
* Closes issue 14634. unittest.mock.create_autospec now supports keyword only ↵Michael Foord2012-04-211-1/+14
| | | | arguments.
* Make unittest.mock.create_autospec resilient against AttributeError on ↵Michael Foord2012-04-131-0/+23
| | | | original object
* unittest.mock.PropertyMock return value and attributes are now standard ↵Michael Foord2012-04-131-0/+11
| | | | MagicMocks
* PEP 417: Adding unittest.mockMichael Foord2012-03-141-0/+835