[issue27376] Add mock_import method to mock module

Michael Foord report at bugs.python.org
Thu Sep 1 04:51:43 EDT 2016


Michael Foord added the comment:

Is this for mocking out runtime dependencies that aren't available at test time? It seems like a good way of masking bugs! I'd be happier with a (or at least an option) to specify the imports that should be mocked. The use case should be mentioned in the docs.

I think the name is slightly confusing. I originally thought this was a function to mock specific imports - not to catch failed imports. mock_missing_import (or similar) would be a better name.

It's common with the mock functions to be able to provide a class to use as the mock function, and to take arbitrary keyword arguments to pass to the mock constructor.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27376>
_______________________________________


More information about the Python-bugs-list mailing list