()
| 685 | |
| 686 | |
| 687 | def test_execute_interpreter_dashm_module(): |
| 688 | # type: () -> None |
| 689 | with temporary_dir() as pex_chroot: |
| 690 | pex_builder = PEXBuilder(path=pex_chroot) |
| 691 | pex_builder.add_source(None, "foo/__init__.py") |
| 692 | with tempfile.NamedTemporaryFile(mode="w") as fp: |
| 693 | fp.write( |
| 694 | dedent( |
| 695 | """\ |
| 696 | import os |
| 697 | import sys |
| 698 | |
| 699 | print("{} {}".format(os.path.realpath(sys.argv[0]), " ".join(sys.argv[1:]))) |
| 700 | """ |
| 701 | ) |
| 702 | ) |
| 703 | fp.flush() |
| 704 | pex_builder.add_source(fp.name, "foo/bar.py") |
| 705 | pex_builder.freeze() |
| 706 | pex = PEX(pex_chroot) |
| 707 | process = pex.run( |
| 708 | args=["-m", "foo.bar", "one", "two"], |
| 709 | stdout=subprocess.PIPE, |
| 710 | stderr=subprocess.PIPE, |
| 711 | blocking=False, |
| 712 | ) |
| 713 | stdout, stderr = process.communicate() |
| 714 | |
| 715 | assert 0 == process.returncode |
| 716 | assert "{} one two\n".format( |
| 717 | os.path.realpath(os.path.join(pex_chroot, "foo/bar.py")) |
| 718 | ) == stdout.decode("utf-8") |
| 719 | assert b"" == stderr |
| 720 | |
| 721 | |
| 722 | def test_execute_interpreter_dashm_module_with_python_options(): |
nothing calls this directly
no test coverage detected