MCPcopy Index your code
hub / github.com/RustPython/RustPython / writes_bytecode_files

Function writes_bytecode_files

Lib/test/test_importlib/util.py:292–306  ·  view source on GitHub ↗

Decorator to protect sys.dont_write_bytecode from mutation and to skip tests that require it to be set to False.

(fxn)

Source from the content-addressed store, hash-verified

290
291
292def writes_bytecode_files(fxn):
293 """Decorator to protect sys.dont_write_bytecode from mutation and to skip
294 tests that require it to be set to False."""
295 if sys.dont_write_bytecode:
296 return unittest.skip("relies on writing bytecode")(fxn)
297 @functools.wraps(fxn)
298 def wrapper(*args, **kwargs):
299 original = sys.dont_write_bytecode
300 sys.dont_write_bytecode = False
301 try:
302 to_return = fxn(*args, **kwargs)
303 finally:
304 sys.dont_write_bytecode = original
305 return to_return
306 return wrapper
307
308
309def ensure_bytecode_path(bytecode_path):

Callers

nothing calls this directly

Calls 1

skipMethod · 0.45

Tested by

no test coverage detected