Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PIXI_PR_NUMBER=4839
71 changes: 71 additions & 0 deletions tests/integration_python/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,77 @@ def test_source_change_trigger_rebuild(pixi: Path, simple_workspace: Workspace)
assert conda_build_params.is_file()


def test_out_of_tree_source_respects_cache(pixi: Path, simple_workspace: Workspace) -> None:
"""
Test that if you have an out-of-tree build with a something like

[package.build]
source = "some-dir"
That it rebuilds correctly when changed and does not rebuild when unchanged
"""
# Create an out-of-tree directory
out_of_tree_dir = simple_workspace.workspace_dir.joinpath("out_of_tree_source")
out_of_tree_dir.mkdir()
# Write out a file we will modify later on
external_file = out_of_tree_dir.joinpath("external.txt")
external_file.write_text("initial content", encoding="utf-8")

# Change the build section
build_section = simple_workspace.package_manifest["package"]["build"]
build_section["source"] = {"path": "../out_of_tree_source"}
configuration = build_section.setdefault("configuration", {})
# Add external glob for detection
configuration["extra-input-globs"] = ["external.txt"]
simple_workspace.recipe["source"] = {"path": "../out_of_tree_source"}

simple_workspace.write_files()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please ask codex to make actual files out of them? That makes it a bit easier to read and debug in my experience


verify_cli_command(
[
pixi,
"install",
"-v",
"--manifest-path",
simple_workspace.workspace_dir,
],
)

conda_build_params = simple_workspace.debug_dir.joinpath("conda_outputs_params.json")
assert conda_build_params.is_file()

# Remove debug file to detect subsequent rebuilds
conda_build_params.unlink()

verify_cli_command(
[
pixi,
"install",
"-v",
"--manifest-path",
simple_workspace.workspace_dir,
],
)

# Out-of-tree sources should be cached when unchanged
assert not conda_build_params.exists()

# Modifying the external source should trigger a rebuild
external_file.write_text("updated content", encoding="utf-8")

verify_cli_command(
[
pixi,
"install",
"-v",
"--manifest-path",
simple_workspace.workspace_dir,
],
)

# And it should be back because the package has been rebuilt
assert conda_build_params.is_file()


def test_project_model_change_trigger_rebuild(
pixi: Path, simple_workspace: Workspace, dummy_channel_1: Path
) -> None:
Expand Down
Loading