Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
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 @@
BUILD_BACKENDS_PR_NUMBER="433"
17 changes: 17 additions & 0 deletions tests/integration_python/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ def write_files(self) -> None:
package_manifest_path = self.package_dir.joinpath("pixi.toml")
package_manifest_path.write_text(tomli_w.dumps(self.package_manifest))

def iter_debug_dirs(self) -> list[Path]:
candidates: list[Path] = []
work_root = self.workspace_dir.joinpath(".pixi", "build", "work")
if work_root.is_dir():
for entry in sorted(work_root.iterdir()):
debug_candidate = entry.joinpath("debug")
if debug_candidate.is_dir():
candidates.append(debug_candidate)
return candidates

def find_debug_file(self, filename: str) -> Path | None:
for debug_dir in self.iter_debug_dirs():
target = debug_dir.joinpath(filename)
if target.is_file():
return target
return None


class ExitCode(IntEnum):
SUCCESS = 0
Expand Down
1 change: 0 additions & 1 deletion tests/integration_python/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def simple_workspace(
"https://prefix.dev/conda-forge",
],
},
"configuration": {"debug-dir": str(debug_dir)},
},
},
}
Expand Down
49 changes: 22 additions & 27 deletions tests/integration_python/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
)


BUILD_RUNNING_STRING = "Running build for recipe:"


def test_build_conda_package(
pixi: Path,
simple_workspace: Workspace,
Expand Down Expand Up @@ -48,17 +51,15 @@ def test_no_change_should_be_fully_cached(pixi: Path, simple_workspace: Workspac
"-v",
"--manifest-path",
simple_workspace.workspace_dir,
]
],
stderr_contains=BUILD_RUNNING_STRING,
)

conda_output_params = simple_workspace.debug_dir.joinpath("conda_outputs_params.json")
conda_build_params = simple_workspace.debug_dir.joinpath("conda_build_v1_params.json")
conda_build_params = simple_workspace.find_debug_file("conda_build_v1_params.json")

assert conda_output_params.is_file()
assert conda_build_params.is_file()
assert conda_build_params is not None

# Remove the files to get a clean state
conda_output_params.unlink()
conda_build_params.unlink()

verify_cli_command(
Expand All @@ -68,18 +69,19 @@ def test_no_change_should_be_fully_cached(pixi: Path, simple_workspace: Workspac
"-v",
"--manifest-path",
simple_workspace.workspace_dir,
]
],
stderr_excludes=BUILD_RUNNING_STRING,
)

# Everything should be cached, so no getMetadata or build call
assert not conda_output_params.is_file()
assert not conda_build_params.is_file()
# Everything should be cached, so no build call,
assert simple_workspace.find_debug_file("conda_build_v1_params.json") is None


def test_recipe_change_trigger_metadata_invalidation(
pixi: Path, simple_workspace: Workspace
) -> None:
simple_workspace.write_files()

verify_cli_command(
[
pixi,
Expand All @@ -88,15 +90,9 @@ def test_recipe_change_trigger_metadata_invalidation(
"--manifest-path",
simple_workspace.workspace_dir,
],
stderr_contains=BUILD_RUNNING_STRING,
)

conda_output_params = simple_workspace.debug_dir.joinpath("conda_outputs_params.json")

assert conda_output_params.is_file()

# Remove the conda build params to get a clean state
conda_output_params.unlink()

# Touch the recipe
simple_workspace.recipe_path.touch()

Expand All @@ -108,11 +104,9 @@ def test_recipe_change_trigger_metadata_invalidation(
"--manifest-path",
simple_workspace.workspace_dir,
],
stderr_contains=BUILD_RUNNING_STRING,
)

# Touching the recipe should trigger a rebuild and therefore create the file
assert conda_output_params.is_file()


def test_project_model_change_trigger_rebuild(
pixi: Path, simple_workspace: Workspace, dummy_channel_1: Path
Expand All @@ -126,19 +120,19 @@ def test_project_model_change_trigger_rebuild(
"--manifest-path",
simple_workspace.workspace_dir,
],
stderr_contains=BUILD_RUNNING_STRING,
)

conda_build_params = simple_workspace.debug_dir.joinpath("conda_build_v1_params.json")

assert conda_build_params.is_file()
conda_build_params = simple_workspace.find_debug_file("conda_build_v1_params.json")
assert conda_build_params is not None

# Remove the conda build params to get a clean state
conda_build_params.unlink()

# modify extra-input-globs
simple_workspace.package_manifest["package"]["build"]["configuration"].setdefault(
"extra-input-globs", ["*.md"]
)
simple_workspace.package_manifest["package"]["build"].setdefault(
"configuration", dict()
).setdefault("extra-input-globs", ["*.md"])
simple_workspace.write_files()
verify_cli_command(
[
Expand All @@ -148,10 +142,11 @@ def test_project_model_change_trigger_rebuild(
"--manifest-path",
simple_workspace.workspace_dir,
],
stderr_contains=BUILD_RUNNING_STRING,
)

# modifying the project model should trigger a rebuild and therefore create a file
assert conda_build_params.is_file()
assert simple_workspace.find_debug_file("conda_build_v1_params.json") is not None


@pytest.mark.slow
Expand Down
Loading