From 831334d5f2ea483bdd9ac5d335456ce6630a0cce Mon Sep 17 00:00:00 2001 From: Fabio Pugliese Ornellas Date: Tue, 17 Dec 2019 11:04:52 +0000 Subject: [PATCH] Disable async validation for builtins --- testslide/mock_callable.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/testslide/mock_callable.py b/testslide/mock_callable.py index e78aa482..743ab6e3 100644 --- a/testslide/mock_callable.py +++ b/testslide/mock_callable.py @@ -597,7 +597,12 @@ def _validate_patch( ) if ( coroutine_function - and not inspect.iscoroutinefunction(template_value) + and ( + # FIXME We cant reliably introspect coroutine functions + # for builtins: https://bugs.python.org/issue38225 + type(template_value) is not type(list.append) + and not inspect.iscoroutinefunction(template_value) + ) and not callable_returns_coroutine ): raise ValueError( @@ -640,7 +645,12 @@ def _validate_patch( ) if ( coroutine_function - and not inspect.iscoroutinefunction(original_callable) + and ( + # FIXME We cant reliably introspect coroutine functions + # for builtins: https://bugs.python.org/issue38225 + type(original_callable) is not type(list.append) + and not inspect.iscoroutinefunction(original_callable) + ) and not callable_returns_coroutine ): raise ValueError(