[New-bugs-announce] [issue39551] mock patch should match behavior of import from when module isn't present in sys.modules

Dino Viehland report at bugs.python.org
Tue Feb 4 15:27:49 EST 2020


New submission from Dino Viehland <dinoviehland at gmail.com>:

The fix for bpo-17636 added support for falling back to sys.modules when a module isn't directly present on the module.  But mock doesn't have the same behavior - it'll try the import, and then try to get the value off the object.  If it's not there it just errors out.

Instead it should also consult sys.modules to be consistent with import semantics.

----------
assignee: dino.viehland
components: Tests
messages: 361366
nosy: dino.viehland
priority: normal
severity: normal
stage: needs patch
status: open
title: mock patch should match behavior of import from when module isn't present in sys.modules
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39551>
_______________________________________


More information about the New-bugs-announce mailing list