mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
bpo-43478: Restrict use of Mock objects as specs (GH-25326)
* Restrict using Mock objects as specs as this is always a test bug where the resulting mock is misleadingly useless. * Skip a broken test that exposes a bug elsewhere in mock (noted in the original issue).
This commit is contained in:
parent
ba1db57198
commit
dccdc500f9
4 changed files with 65 additions and 8 deletions
|
|
@ -199,9 +199,9 @@ def test_create_autospec_instance(self):
|
|||
with self.assertRaises(RuntimeError):
|
||||
create_autospec(async_func, instance=True)
|
||||
|
||||
@unittest.skip('Broken test from https://bugs.python.org/issue37251')
|
||||
def test_create_autospec_awaitable_class(self):
|
||||
awaitable_mock = create_autospec(spec=AwaitableClass())
|
||||
self.assertIsInstance(create_autospec(awaitable_mock), AsyncMock)
|
||||
self.assertIsInstance(create_autospec(AwaitableClass), AsyncMock)
|
||||
|
||||
def test_create_autospec(self):
|
||||
spec = create_autospec(async_func_args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue