Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editable installs now respect the value of wheel.install-dir #867

Merged
merged 11 commits into from
Aug 20, 2024
48 changes: 48 additions & 0 deletions tests/test_editable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import textwrap
from pathlib import Path

import pytest
Expand Down Expand Up @@ -105,3 +106,50 @@ def test_cython_pxd(monkeypatch, tmp_path, editable, editable_mode, isolated):
*editable_flag,
".",
)


@pytest.mark.compile()
@pytest.mark.configure()
@pytest.mark.integration()
@pytest.mark.usefixtures("package_simplest_c")
def test_install_dir(isolated):
isolated.install("pip>=23")
isolated.install("scikit-build-core")

settings_overrides = {
"build-dir": "build/{wheel_tag}",
"wheel.install-dir": "sub_pkg",
"editable.rebuild": "true",
}
# Create a dummy _module to satisfy the import
Path("./src/simplest/_module.py").write_text(
textwrap.dedent(
"""
def square(__x: float, __y: float) -> float:
pass
"""
)
)

isolated.install(
"-v",
*[f"--config-settings={k}={v}" for k, v in settings_overrides.items()],
"--no-build-isolation",
"-e",
".",
)

# Make sure the package is correctly installed in the subdirectory
sub_pkg_path = isolated.platlib / "sub_pkg"
c_module_glob = list(sub_pkg_path.glob("simplest/_module*"))
assert len(c_module_glob) == 1
c_module = c_module_glob[0]
assert c_module.exists()
# If `install-dir` was not taken into account it would install here
failed_c_module = sub_pkg_path / "../simplest" / c_module.name
assert not failed_c_module.exists()

# Run an import in order to re-trigger the rebuild and check paths again
isolated.execute("import simplest")
LecrisUT marked this conversation as resolved.
Show resolved Hide resolved
assert c_module.exists()
assert not failed_c_module.exists()
Loading