()
| 210 | |
| 211 | |
| 212 | def test_run_pex(): |
| 213 | # type: () -> None |
| 214 | |
| 215 | def assert_run_pex(python=None, pex_args=None): |
| 216 | # type: (Optional[str], Optional[List[str]]) -> List[Text] |
| 217 | pex_args = list(pex_args) if pex_args else [] |
| 218 | results = run_pex_command( |
| 219 | python=python, |
| 220 | args=pex_args |
| 221 | + ["ansicolors==1.1.8", "--", "-c", 'import colors; print(" ".join(colors.COLORS))'], |
| 222 | quiet=True, |
| 223 | ) |
| 224 | results.assert_success() |
| 225 | assert "black red green yellow blue magenta cyan white" == results.output.strip() |
| 226 | return results.error.splitlines() |
| 227 | |
| 228 | incompatible_platforms_warning_msg = ( |
| 229 | "WARNING: attempting to run PEX with incompatible platforms!" |
| 230 | ) |
| 231 | |
| 232 | assert incompatible_platforms_warning_msg not in assert_run_pex() |
| 233 | assert incompatible_platforms_warning_msg not in assert_run_pex(pex_args=["--platform=current"]) |
| 234 | assert incompatible_platforms_warning_msg not in assert_run_pex( |
| 235 | pex_args=["--platform={}".format(PythonInterpreter.get().platform)] |
| 236 | ) |
| 237 | |
| 238 | py39 = ensure_python_interpreter(PY39) |
| 239 | stderr_lines = assert_run_pex(python=py39, pex_args=["--platform=macosx-10.13-x86_64-cp-37-m"]) |
| 240 | assert incompatible_platforms_warning_msg in stderr_lines |
nothing calls this directly
no test coverage detected