Skip to content

Commit

Permalink
Skip alpine/musl altogether
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Apr 26, 2023
1 parent d91865a commit 9fae01e
Showing 1 changed file with 31 additions and 30 deletions.
61 changes: 31 additions & 30 deletions test-crates/pyo3-mixed/check_installed/check_installed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,36 @@
rust_args = json.loads(rust_args)
python_args = json.loads(python_args)

# On linux we get sys.executable, windows resolve the path and mac os gives us a third
# path (
# {prefix}/Python.framework/Versions/3.10/Resources/Python.app/Contents/MacOS/Python
# vs
# {prefix}/Python.framework/Versions/3.10/bin/python3.10
# on cirrus ci)
# On windows, cpython resolves while pypy doesn't.
# The script for cpython is actually a distinct file from the system interpreter for
# windows and mac
# On alpine/musl, rust_args is empty
if len(rust_args) > 0 and platform.system() == "Linux":
assert os.path.samefile(rust_args[0], sys.executable), (
rust_args,
sys.executable,
os.path.realpath(rust_args[0]),
os.path.realpath(sys.executable),
)

# Windows can't decide if it's with or without .exe, FreeBSB just doesn't work for some reason
if platform.system() in ["Darwin", "Linux"]:
# Unix venv layout (and hopefully also on more exotic platforms)
print_cli_args = str(Path(sys.prefix).joinpath("bin").joinpath(script_name))
assert rust_args[1] == print_cli_args, (rust_args, print_cli_args)
assert python_args[0] == print_cli_args, (python_args, print_cli_args)

# FreeBSB just doesn't work for some reason
if platform.system() in ["Darwin", "Linux", "Windows"]:
# Rust contains the python executable as first argument but python does not
assert rust_args[2:] == args, rust_args
assert python_args[1:] == args, python_args
# On alpine/musl, rust_args is empty so we skip all tests on musl
if len(rust_args) > 0:
# On linux we get sys.executable, windows resolve the path and mac os gives us a third
# path (
# {prefix}/Python.framework/Versions/3.10/Resources/Python.app/Contents/MacOS/Python
# vs
# {prefix}/Python.framework/Versions/3.10/bin/python3.10
# on cirrus ci)
# On windows, cpython resolves while pypy doesn't.
# The script for cpython is actually a distinct file from the system interpreter for
# windows and mac
if platform.system() == "Linux":
assert os.path.samefile(rust_args[0], sys.executable), (
rust_args,
sys.executable,
os.path.realpath(rust_args[0]),
os.path.realpath(sys.executable),
)

# Windows can't decide if it's with or without .exe, FreeBSB just doesn't work for some reason
if platform.system() in ["Darwin", "Linux"]:
# Unix venv layout (and hopefully also on more exotic platforms)
print_cli_args = str(Path(sys.prefix).joinpath("bin").joinpath(script_name))
assert rust_args[1] == print_cli_args, (rust_args, print_cli_args)
assert python_args[0] == print_cli_args, (python_args, print_cli_args)

# FreeBSB just doesn't work for some reason
if platform.system() in ["Darwin", "Linux", "Windows"]:
# Rust contains the python executable as first argument but python does not
assert rust_args[2:] == args, rust_args
assert python_args[1:] == args, python_args

print("SUCCESS")

0 comments on commit 9fae01e

Please sign in to comment.