mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-40173: Fix test.support.import_helper.import_fresh_module() (GH-28654)
* Work correctly if an additional fresh module imports other additional fresh module which imports a blocked module. * Raises ImportError if the specified module cannot be imported while all additional fresh modules are successfully imported. * Support blocking packages. * Always restore the import state of fresh and blocked modules and their submodules. * Fix test_decimal and test_xml_etree which depended on an undesired side effect of import_fresh_module().
This commit is contained in:
parent
b07fddd527
commit
ec4d917a6a
4 changed files with 32 additions and 52 deletions
|
@ -62,7 +62,7 @@ if sys.platform == 'darwin':
|
|||
|
||||
C = import_fresh_module('decimal', fresh=['_decimal'])
|
||||
P = import_fresh_module('decimal', blocked=['_decimal'])
|
||||
orig_sys_decimal = sys.modules['decimal']
|
||||
import decimal as orig_sys_decimal
|
||||
|
||||
# fractions module must import the correct decimal module.
|
||||
cfractions = import_fresh_module('fractions', fresh=['fractions'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue