MCPcopy Index your code
hub / github.com/python/cpython / pycompilecmd

Method pycompilecmd

Lib/test/test_py_compile.py:283–292  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

281
282 @support.requires_subprocess()
283 def pycompilecmd(self, *args, **kwargs):
284 # assert_python_* helpers don't return proc object. We'll just use
285 # subprocess.run() instead of spawn_python() and its friends to test
286 # stdin support of the CLI.
287 opts = '-m' if __debug__ else '-Om'
288 if args and args[0] == '-' and 'input' in kwargs:
289 return subprocess.run([sys.executable, opts, 'py_compile', '-'],
290 input=kwargs['input'].encode(),
291 capture_output=True)
292 return script_helper.assert_python_ok(opts, 'py_compile', *args, **kwargs)
293
294 def pycompilecmd_failure(self, *args):
295 return script_helper.assert_python_failure('-m', 'py_compile', *args)

Callers 2

test_stdinMethod · 0.95
test_with_filesMethod · 0.95

Calls 3

assert_python_okMethod · 0.80
runMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected