cpython/Lib/unittest/test
Berker Peksag 64b9a15886 [3.6] 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 01:31:04 +03:00
..
testmock [3.6] bpo-29403: Fix mock's broken autospec behavior on method-bound builtin functions (GH-3) 2017-07-22 01:31:04 +03:00
__init__.py
__main__.py Issue #19013: add a __main__ to unittest.test to ease CLI invocation 2013-09-14 00:37:18 +02:00
_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 #27364: fix "incorrect" uses of escape character in the stdlib. 2016-09-08 13:59:53 -04:00
test_break.py Issue #22936: Allow showing local variables in unittest errors. 2015-03-06 13:46:35 +13:00
test_case.py bpo-23890: Fix ref cycle in TestCase.assertRaises (#858) 2017-06-16 00:18:15 +02:00
test_discovery.py bpo-30813: Fix unittest when hunting refleaks (#2502) (#2505) 2017-06-30 13:12:20 +02:00
test_functiontestcase.py #22092: use absolute imports in unittest tests. Patch by Vajrasky Kok. 2014-08-07 03:20:22 +03:00
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 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 Issue #22032: __qualname__ instead of __name__ is now always used to format 2014-07-22 15:00:37 +03:00
test_skipping.py Issue #21112: Fix regression in unittest.expectedFailure on subclasses. 2015-08-28 10:34:51 +12:00
test_suite.py #22092: use absolute imports in unittest tests. Patch by Vajrasky Kok. 2014-08-07 03:20:22 +03:00