MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / run_code

Function run_code

tests/test_pixmap.py:293–310  ·  view source on GitHub ↗
(code, code_path, *, check=True, venv=None, venv_args='', pythonpath=None, stdout=None)

Source from the content-addressed store, hash-verified

291 return subprocess.run(command, shell=1, check=check, stdout=stdout, text=1)
292
293 def run_code(code, code_path, *, check=True, venv=None, venv_args='', pythonpath=None, stdout=None):
294 code = textwrap.dedent(code)
295 with open(code_path, 'w') as f:
296 f.write(code)
297 prefix = f'PYTHONPATH={pythonpath} ' if pythonpath else ''
298 if venv:
299 # Have seen this fail on Github in a curious way:
300 #
301 # Running: /tmp/tmp.fBeKNLJQKk/venv/bin/python -m venv --system-site-packages /project/tests/resources/test_3493_venv
302 # Error: [Errno 2] No such file or directory: '/project/tests/resources/test_3493_venv/bin/python'
303 #
304 r = run(f'{sys.executable} -m venv {venv_args} {venv}', check=check)
305 if r.returncode:
306 return r
307 r = run(f'. {venv}/bin/activate && {prefix}python {code_path}', check=check, stdout=stdout)
308 else:
309 r = run(f'{prefix}{sys.executable} {code_path}', check=check, stdout=stdout)
310 return r
311
312 # Find location of system install of `gi`.
313 r = run_code(

Callers 2

test_3493Function · 0.85
doFunction · 0.85

Calls 2

runFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…