[New-bugs-announce] [issue27376] Add mock_import method to mock module

Eyal Posener report at bugs.python.org
Thu Jun 23 13:12:17 EDT 2016


New submission from Eyal Posener:

Add mock_import method.

A helper function to mask ``ImportError``s on a scoped code, using the ``with`` statement, or in method a method used as a decorator.
Failed imports will be ignored, unless specified by the *do_not_mock* argument.

The *do_not_mock* argument is a package or module name, or package or module names list. When specified, and imported in the scoped mocked code, importing them must succeed. If ``None`` (the default) then no import must succeed.

----------
components: Library (Lib)
files: mock_import.patch
keywords: patch
messages: 269127
nosy: Eyal Posener
priority: normal
severity: normal
status: open
title: Add mock_import method to mock module
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file43522/mock_import.patch

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


More information about the New-bugs-announce mailing list