cpython/Lib/unittest/test
Berker Peksag e78dc0aaf0 [3.5] 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.

(cherry picked from commit 856cbcc12f)
2017-07-22 02:27:17 +03:00
..
testmock [3.5] bpo-29403: Fix mock's broken autospec behavior on method-bound builtin functions (GH-3) 2017-07-22 02:27:17 +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 Issue #20362: Honour TestCase.longMessage correctly in assertRegex. 2015-08-20 11:13:09 +12:00
test_break.py
test_case.py Fix ref cycles in TestCase.assertRaises() (#193) (#2228) 2017-06-16 00:51:24 +02:00
test_discovery.py bpo-30813: Fix unittest when hunting refleaks (#2502) (#2506) 2017-06-30 13:12:15 +02:00
test_functiontestcase.py
test_loader.py Issue #29274: tests cases → test cases 2017-01-18 12:06:38 +00:00
test_program.py
test_result.py Issue #25651: Allow falsy values to be used for msg parameter of subTest() 2016-09-21 19:34:15 +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