MCPcopy
hub / github.com/pex-tool/pex / test_issues_892

Function test_issues_892

tests/test_resolver.py:497–542  ·  view source on GitHub ↗
(pex_project_dir)

Source from the content-addressed store, hash-verified

495
496
497def test_issues_892(pex_project_dir):
498 # type: (str) -> None
499 python27 = ensure_python_interpreter(PY27)
500 program = dedent(
501 """\
502 from __future__ import print_function
503
504 import os
505 import sys
506
507
508 # This puts python3.10 stdlib on PYTHONPATH.
509 os.environ['PYTHONPATH'] = os.pathsep.join(sys.path)
510
511 sys.path.append({pex_project_dir!r})
512 from pex import resolver
513 from pex.interpreter import PythonInterpreter
514 from pex.requirements import parse_requirement_string
515 from pex.targets import Targets
516
517
518 python27 = PythonInterpreter.from_binary({python27!r})
519 result = resolver.resolve(
520 targets=Targets(interpreters=(python27,)),
521 requirements=[parse_requirement_string('packaging==19.2')],
522 )
523 print('Resolved: {{}}'.format(result))
524 """
525 ).format(pex_project_dir=pex_project_dir, python27=python27)
526
527 python310 = ensure_python_interpreter(PY310)
528 cmd, process = PythonInterpreter.from_binary(python310).open_process(
529 args=["-c", program], stderr=subprocess.PIPE
530 )
531 _, stderr = process.communicate()
532 assert process.returncode == 0, dedent(
533 """
534 Command {cmd} failed with {returncode}.
535
536 STDERR
537 ======
538 {stderr}
539 """.format(
540 cmd=cmd, returncode=process.returncode, stderr=stderr.decode("utf8")
541 )
542 )
543
544
545def test_download2():

Callers

nothing calls this directly

Calls 5

from_binaryMethod · 0.80
communicateMethod · 0.80
decodeMethod · 0.80
open_processMethod · 0.45

Tested by

no test coverage detected