Source writing bytecode: small
(seconds, repeat)
| 99 | |
| 100 | |
| 101 | def source_writing_bytecode(seconds, repeat): |
| 102 | """Source writing bytecode: small""" |
| 103 | assert not sys.dont_write_bytecode |
| 104 | name = '__importlib_test_benchmark__' |
| 105 | with util.create_modules(name) as mapping: |
| 106 | sys.meta_path.append(importlib.machinery.PathFinder) |
| 107 | loader = (importlib.machinery.SourceFileLoader, |
| 108 | importlib.machinery.SOURCE_SUFFIXES) |
| 109 | sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) |
| 110 | def cleanup(): |
| 111 | sys.modules.pop(name) |
| 112 | os.unlink(cache_from_source(mapping[name])) |
| 113 | for result in bench(name, cleanup, repeat=repeat, seconds=seconds): |
| 114 | assert not os.path.exists(cache_from_source(mapping[name])) |
| 115 | yield result |
| 116 | |
| 117 | |
| 118 | def _writing_bytecode(module): |
nothing calls this directly
no test coverage detected
searching dependent graphs…