Lisa Roach <lisaroac...@gmail.com> added the comment:

This should be simple to do, after https://github.com/python/cpython/pull/16060 
we can add:

            elif self._mock_methods and _new_name in self._mock_methods:
                # Methods that are not in _spec_asyncs are normal methods
                klass = MagicMock

to _get_child_mocks and test with:

    def test_normal_methods_on_class(self):
        am = AsyncMock(AsyncClass)
        self.assertIsInstance(am.async_method, AsyncMock)
        self.assertIsInstance(am.normal_method, MagicMock)

This might be starting to make _get_child_mocks too complicated, and no longer 
follows the default "child mocks are the same as their parent". I am not sure 
how to redefine _get_child_mocks without needing to double up a lot of code to 
support MagicMocks having AsyncMock child_mocks as well.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38163>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to