|
5 | 5 |
|
6 | 6 | """ |
7 | 7 | from test.test_importlib import util |
8 | | -from test.test_importlib.source import util as source_util |
9 | 8 | import decimal |
10 | 9 | import imp |
11 | 10 | import importlib |
@@ -65,11 +64,11 @@ def source_wo_bytecode(seconds, repeat): |
65 | 64 | try: |
66 | 65 | name = '__importlib_test_benchmark__' |
67 | 66 | # Clears out sys.modules and puts an entry at the front of sys.path. |
68 | | - with source_util.create_modules(name) as mapping: |
| 67 | + with util.create_modules(name) as mapping: |
69 | 68 | assert not os.path.exists(imp.cache_from_source(mapping[name])) |
70 | 69 | sys.meta_path.append(importlib.machinery.PathFinder) |
71 | 70 | loader = (importlib.machinery.SourceFileLoader, |
72 | | - importlib.machinery.SOURCE_SUFFIXES, True) |
| 71 | + importlib.machinery.SOURCE_SUFFIXES) |
73 | 72 | sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) |
74 | 73 | yield from bench(name, lambda: sys.modules.pop(name), repeat=repeat, |
75 | 74 | seconds=seconds) |
@@ -102,10 +101,10 @@ def source_writing_bytecode(seconds, repeat): |
102 | 101 | """Source writing bytecode: small""" |
103 | 102 | assert not sys.dont_write_bytecode |
104 | 103 | name = '__importlib_test_benchmark__' |
105 | | - with source_util.create_modules(name) as mapping: |
| 104 | + with util.create_modules(name) as mapping: |
106 | 105 | sys.meta_path.append(importlib.machinery.PathFinder) |
107 | 106 | loader = (importlib.machinery.SourceFileLoader, |
108 | | - importlib.machinery.SOURCE_SUFFIXES, True) |
| 107 | + importlib.machinery.SOURCE_SUFFIXES) |
109 | 108 | sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) |
110 | 109 | def cleanup(): |
111 | 110 | sys.modules.pop(name) |
@@ -136,10 +135,10 @@ def cleanup(): |
136 | 135 | def source_using_bytecode(seconds, repeat): |
137 | 136 | """Source w/ bytecode: small""" |
138 | 137 | name = '__importlib_test_benchmark__' |
139 | | - with source_util.create_modules(name) as mapping: |
| 138 | + with util.create_modules(name) as mapping: |
140 | 139 | sys.meta_path.append(importlib.machinery.PathFinder) |
141 | 140 | loader = (importlib.machinery.SourceFileLoader, |
142 | | - importlib.machinery.SOURCE_SUFFIXES, True) |
| 141 | + importlib.machinery.SOURCE_SUFFIXES) |
143 | 142 | sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) |
144 | 143 | py_compile.compile(mapping[name]) |
145 | 144 | assert os.path.exists(imp.cache_from_source(mapping[name])) |
|
0 commit comments