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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Test-only change; no changelog entry or version bump.
21 changes: 11 additions & 10 deletions source/isaaclab/test/cli/test_env_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import shutil
import subprocess
from pathlib import Path
from unittest import mock

import pytest
Expand Down Expand Up @@ -59,11 +60,11 @@ def test_environment_setup_accepts_marked_source_build(tmp_path):
envs._reject_downloaded_isaac_sim("uv")


def test_launcher_rejects_downloaded_isaac_sim_with_active_environment(tmp_path):
def test_launcher_rejects_downloaded_isaac_sim_with_active_environment(source_checkout_root: Path, tmp_path):
"""Platform launchers must reject an active environment before selecting its Python."""
launcher_name = "isaaclab.bat" if envs.is_windows() else "isaaclab.sh"
launcher = tmp_path / launcher_name
shutil.copy2(envs.ISAACLAB_ROOT / launcher_name, launcher)
shutil.copy2(source_checkout_root / launcher_name, launcher)
(tmp_path / "_isaac_sim").mkdir()

environment = os.environ.copy()
Expand All @@ -78,10 +79,10 @@ def test_launcher_rejects_downloaded_isaac_sim_with_active_environment(tmp_path)


@pytest.mark.skipif(envs.is_windows(), reason="Linux launcher behavior")
def test_launcher_uses_bundled_python_with_inactive_default_environment(tmp_path):
def test_launcher_uses_bundled_python_with_inactive_default_environment(source_checkout_root: Path, tmp_path):
"""An inactive default environment must not override the bundled Python."""
launcher = tmp_path / "isaaclab.sh"
shutil.copy2(envs.ISAACLAB_ROOT / "isaaclab.sh", launcher)
shutil.copy2(source_checkout_root / "isaaclab.sh", launcher)
bundled_python = tmp_path / "_isaac_sim" / "python.sh"
bundled_python.parent.mkdir()
bundled_python.write_text("#!/usr/bin/env bash\necho bundled-python\n")
Expand All @@ -102,10 +103,10 @@ def test_launcher_uses_bundled_python_with_inactive_default_environment(tmp_path


@pytest.mark.skipif(envs.is_windows(), reason="Linux launcher behavior")
def test_launcher_accepts_virtual_environment_on_bundled_python(tmp_path):
def test_launcher_accepts_virtual_environment_on_bundled_python(source_checkout_root: Path, tmp_path):
"""A virtual environment created on the package's own Python runs that interpreter, so it is allowed."""
launcher = tmp_path / "isaaclab.sh"
shutil.copy2(envs.ISAACLAB_ROOT / "isaaclab.sh", launcher)
shutil.copy2(source_checkout_root / "isaaclab.sh", launcher)
bundled_python = tmp_path / "_isaac_sim" / "python.sh"
bundled_python.parent.mkdir()
bundled_python.write_text("#!/usr/bin/env bash\necho bundled-python\n")
Expand All @@ -126,10 +127,10 @@ def test_launcher_accepts_virtual_environment_on_bundled_python(tmp_path):


@pytest.mark.skipif(envs.is_windows(), reason="Linux launcher behavior")
def test_launcher_rejects_virtual_environment_on_foreign_python(tmp_path):
def test_launcher_rejects_virtual_environment_on_foreign_python(source_checkout_root: Path, tmp_path):
"""A virtual environment built on another interpreter stays rejected."""
launcher = tmp_path / "isaaclab.sh"
shutil.copy2(envs.ISAACLAB_ROOT / "isaaclab.sh", launcher)
shutil.copy2(source_checkout_root / "isaaclab.sh", launcher)
(tmp_path / "_isaac_sim").mkdir()
venv = tmp_path / "venv"
(venv / "bin").mkdir(parents=True)
Expand All @@ -145,10 +146,10 @@ def test_launcher_rejects_virtual_environment_on_foreign_python(tmp_path):


@pytest.mark.skipif(envs.is_windows(), reason="Linux launcher behavior")
def test_launcher_allows_relinking_unmarked_source_build(tmp_path):
def test_launcher_allows_relinking_unmarked_source_build(source_checkout_root: Path, tmp_path):
"""The source-build command must bypass downloaded-package environment rejection."""
launcher = tmp_path / "isaaclab.sh"
shutil.copy2(envs.ISAACLAB_ROOT / "isaaclab.sh", launcher)
shutil.copy2(source_checkout_root / "isaaclab.sh", launcher)
(tmp_path / "_isaac_sim").mkdir()
active_python = tmp_path / "virtual-env" / "bin" / "python"
active_python.parent.mkdir(parents=True)
Expand Down
2 changes: 1 addition & 1 deletion source/isaaclab/test/cli/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class TestEnsureNewton:
def _completed(stdout: str = "", returncode: int = 0) -> subprocess.CompletedProcess:
return subprocess.CompletedProcess(args=[], returncode=returncode, stdout=stdout, stderr="")

def test_installs_pinned_release_when_absent(self):
def test_installs_pinned_release_when_absent(self, source_checkout_root: Path):
"""When the pinned release is not installed, uninstall Newton then install it."""
from isaaclab.cli.commands import install

Expand Down
1 change: 1 addition & 0 deletions source/isaaclab/test/cli/test_install_command_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def _make_mock_env(**extra_env):
return env


@pytest.mark.usefixtures("source_checkout_root")
class TestCommandInstallDispatch:
"""Test that command_install() calls the right functions with the right args."""

Expand Down
5 changes: 3 additions & 2 deletions source/isaaclab/test/cli/test_install_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ def test_probe_receives_original_pythonpath(self, tmp_path):
# ---------------------------------------------------------------------------


@pytest.mark.usefixtures("source_checkout_root")
class TestEnsureCudaTorch:
"""Tests for :func:`_ensure_cuda_torch` across architectures and environment types.

Expand Down Expand Up @@ -973,14 +974,14 @@ def test_all_non_nvidia_packages_are_repointed(self, tmp_path, pkg_name):
class TestInstallRootExtraExcludesIsaacSim:
"""The ``teleop`` extra lists Isaac Sim for uv, but pip must never resolve it inline."""

def test_root_extra_dependencies_exclude_isaacsim(self):
def test_root_extra_dependencies_exclude_isaacsim(self, source_checkout_root: Path):
"""pip has no override mechanism, so isaacsim + isaacteleop in one pass cannot resolve."""
dependencies = install_cmd._root_extra_dependencies("teleop")

assert not any(d.startswith("isaacsim") for d in dependencies)
assert any(d.startswith("isaacteleop") for d in dependencies)

def test_install_root_extra_omits_isaacsim_from_the_pip_command(self, tmp_path):
def test_install_root_extra_omits_isaacsim_from_the_pip_command(self, source_checkout_root: Path, tmp_path):
"""``./isaaclab.sh -i teleop`` must not hand Isaac Sim to pip alongside Isaac Teleop."""
python_exe = str(tmp_path / "python")
pip_cmd = [python_exe, "-m", "pip"]
Expand Down
6 changes: 3 additions & 3 deletions source/isaaclab/test/cli/test_teleop_entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@


@pytest.mark.parametrize(("command", "script_parts"), TELEOP_WORKFLOWS.items())
def test_teleop_workflow_help_exposes_task_preset_selectors(command, script_parts):
def test_teleop_workflow_help_exposes_task_preset_selectors(source_checkout_root: Path, command, script_parts):
"""Every teleop workflow accepts the task preset selectors documented for teleoperation."""
script = cli.ISAACLAB_ROOT.joinpath(*script_parts)
script = source_checkout_root.joinpath(*script_parts)

result = subprocess.run(
[sys.executable, str(script), "--help"],
cwd=cli.ISAACLAB_ROOT,
cwd=source_checkout_root,
capture_output=True,
text=True,
check=False,
Expand Down
Loading