Skip to content

Commit

Permalink
Replicate Huon's layout matrix.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Mar 27, 2024
1 parent a6bdb31 commit 824a4b0
Showing 1 changed file with 44 additions and 6 deletions.
50 changes: 44 additions & 6 deletions tests/integration/test_issue_2391.py
Expand Up @@ -4,33 +4,69 @@
import os.path
import re
import subprocess
import sys

import pytest

from pex.layout import Layout
from pex.typing import TYPE_CHECKING
from testing import run_pex_command

if TYPE_CHECKING:
from typing import Any


def test_requirements_pex_wheel_type_mismatch(tmpdir):
# type: (Any)-> None
@pytest.mark.parametrize(
"reqs_pex_layout", [pytest.param(layout, id=str(layout)) for layout in Layout.values()]
)
@pytest.mark.parametrize(
"out_pex_layout", [pytest.param(layout, id=str(layout)) for layout in Layout.values()]
)
def test_requirements_pex_wheel_type_mismatch(
tmpdir, # type: Any
reqs_pex_layout, # type: Layout.Value
out_pex_layout, # type: Layout.Value
):
# type: (...) -> None

pre_installed_reqs_pex = os.path.join(str(tmpdir), "pre_installed_reqs.pex")
run_pex_command(args=["cowsay==5.0", "-o", pre_installed_reqs_pex]).assert_success()
run_pex_command(
args=["cowsay==5.0", "--layout", str(reqs_pex_layout), "-o", pre_installed_reqs_pex]
).assert_success()

wheel_file_reqs_pex = os.path.join(str(tmpdir), "wheel_file_reqs.pex")
run_pex_command(
args=["cowsay==5.0", "--no-pre-install-wheels", "-o", wheel_file_reqs_pex]
args=[
"cowsay==5.0",
"--no-pre-install-wheels",
"--layout",
str(reqs_pex_layout),
"-o",
wheel_file_reqs_pex,
]
).assert_success()

pex = os.path.join(str(tmpdir), "pex")

def assert_pex():
# type: () -> None
assert "5.0" == subprocess.check_output(args=[pex, "--version"]).decode("utf-8").strip()
assert (
"5.0"
== subprocess.check_output(args=[sys.executable, pex, "--version"])
.decode("utf-8")
.strip()
)

run_pex_command(
args=["--requirements-pex", pre_installed_reqs_pex, "-c" "cowsay", "-o", pex]
args=[
"--requirements-pex",
pre_installed_reqs_pex,
"-c" "cowsay",
"--layout",
str(out_pex_layout),
"-o",
pex,
]
).assert_success()
assert_pex()

Expand All @@ -41,6 +77,8 @@ def assert_pex():
"--no-pre-install-wheels",
"-c",
"cowsay",
"--layout",
str(out_pex_layout),
"-o",
pex,
]
Expand Down

0 comments on commit 824a4b0

Please sign in to comment.