From 5c435f1ca41a03cfb965cb7a4d1ddcf0e8c30ada Mon Sep 17 00:00:00 2001 From: Chris Livingston Date: Wed, 8 Nov 2017 11:52:53 -0800 Subject: [PATCH] Add test for pex exec with just constraints --- tests/test_integration.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_integration.py b/tests/test_integration.py index bce32eceb..3c82c436b 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -537,6 +537,24 @@ def test_plain_pex_exec_no_ppp_no_pp_no_constraints(): assert str(sys.executable).encode() in stdout +@pytest.mark.skipif(NOT_CPYTHON_36) +def test_plain_pex_exec_with_just_constraints(): + with temporary_dir() as td: + pex_out_path = os.path.join(td, 'pex.pex') + res = run_pex_command(['--disable-cache', + '--interpreter-constraint=>3', + '--interpreter-constraint=<3.8', + '-o', pex_out_path]) + res.assert_success() + + stdin_payload = b'import sys; print(sys.executable); sys.exit(0)' + stdout, rc = run_simple_pex(pex_out_path, stdin=stdin_payload) + assert rc == 0 + str_version = str(stdout).split(" ")[1].split('.') # parse interpreter version + version = tuple(map(lambda x: int(x), str_version)) + assert (3, 0, 0) < version < (3, 8, 0) + + def test_pex_exec_with_pex_python_path_only(): ensure_python_interpreter('2.7.10') ensure_python_interpreter('3.6.3')