Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion crates/pixi_core/src/workspace/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ impl WorkspaceLocator {
/// Called to locate the workspace or error out if none could be located.
pub fn locate(self) -> Result<Workspace, WorkspaceLocatorError> {
// Determine the search root
let explicit_start = matches!(&self.start, DiscoveryStart::ExplicitManifest(_));
let discovery_start = match self.start {
DiscoveryStart::ExplicitManifest(path) => {
pixi_manifest::DiscoveryStart::ExplicitManifest(path)
Expand Down Expand Up @@ -191,7 +192,7 @@ impl WorkspaceLocator {
};

// Take into consideration any environment variables that may be set.
if self.consider_environment {
if self.consider_environment && !explicit_start {
if let Some(WithWarnings {
value: manifests,
warnings: mut env_warnings,
Expand Down
33 changes: 33 additions & 0 deletions tests/integration_python/test_manifest_path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import json
from pathlib import Path

from .common import EMPTY_BOILERPLATE_PROJECT, verify_cli_command


def test_explicit_manifest_correct_location(pixi: Path, tmp_path: Path) -> None:
current_dir = tmp_path / "current"
target_dir = tmp_path / "target"
current_dir.mkdir()
target_dir.mkdir()

(current_dir / "pixi.toml").write_text(EMPTY_BOILERPLATE_PROJECT)
(target_dir / "pixi.toml").write_text(EMPTY_BOILERPLATE_PROJECT)

out = verify_cli_command(
[
pixi,
"shell-hook",
"--manifest-path",
target_dir,
"--json",
],
cwd=current_dir,
)

payload = json.loads(out.stdout)
value = payload["environment_variables"].get("PIXI_PROJECT_MANIFEST")
assert value is not None, "PIXI_PROJECT_MANIFEST missing from activated env"

expected = (target_dir / "pixi.toml").resolve()
actual = Path(value).resolve()
assert actual == expected
Loading