Skip to content

Commit

Permalink
Add test for pex exec with just constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Livingston committed Nov 8, 2017
1 parent 93fa7c4 commit 5c435f1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 5c435f1

Please sign in to comment.