[New-bugs-announce] [issue39551] mock patch should match behavior of import from when module isn't present in sys.modules
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.
stage: needs patch
title: mock patch should match behavior of import from when module isn't present in sys.modules
versions: Python 3.9
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce