cpython/Lib/unittest/test
Aaron Gallagher 856cbcc12f bpo-29403: Fix mock's broken autospec behavior on method-bound builtin 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.
2017-07-20 03:01:14 +03:00
..
testmock bpo-29403: Fix mock's broken autospec behavior on method-bound builtin functions (GH-3) 2017-07-20 03:01:14 +03:00
__init__.py
__main__.py
_test_warnings.py
dummy.py
support.py Issue #24245: Eliminated senseless expect clauses that have no any effect. 2015-05-20 16:10:04 +03:00
test_assertions.py #30190: fix invalid escape sequence warnings (#1534) 2017-05-10 20:13:20 +02:00
test_break.py Issue #22936: Allow showing local variables in unittest errors. 2015-03-06 13:46:35 +13:00
test_case.py Fix ref cycles in TestCase.assertRaises() (#193) 2017-03-28 00:56:28 +02:00
test_discovery.py bpo-30813: Fix unittest when hunting refleaks (#2502) 2017-06-30 12:52:52 +02:00
test_functiontestcase.py
test_loader.py Issue 29274: Merge doc fixes from 3.5 2017-01-18 12:11:12 +00:00
test_program.py Issue #22936: Allow showing local variables in unittest errors. 2015-03-06 13:46:35 +13:00
test_result.py bpo-30664: The description of a unittest subtest now preserves the (#2265) 2017-06-23 21:47:39 +03:00
test_runner.py Fix ResourceWarning in test_unittest when interrupted 2016-03-30 01:15:28 +02:00
test_setups.py
test_skipping.py Issue #21112: Fix regression in unittest.expectedFailure on subclasses. 2015-08-28 10:34:51 +12:00
test_suite.py