7d851dcb7e
Adds a non-fatal bubblewrap check to the doctor command that reports whether the bwrap binary is available. This is necessary for sandboxed sessions and the check is displayed alongside other system requirement checks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
from unittest.mock import patch
|
|
|
|
from click.testing import CliRunner
|
|
|
|
from hqt import cli as cli_module
|
|
from hqt.cli import main
|
|
|
|
|
|
def _which(found: set[str]):
|
|
return lambda name: f"/usr/bin/{name}" if name in found else None
|
|
|
|
|
|
def test_doctor_reports_bwrap_present():
|
|
"""Test that doctor reports bubblewrap when present."""
|
|
# Patch the single shutil.which used by both cli and registry
|
|
with patch.object(
|
|
cli_module.shutil, "which", side_effect=_which({"tmux", "bwrap"})
|
|
):
|
|
result = CliRunner().invoke(main, ["doctor"])
|
|
assert result.exit_code == 0
|
|
assert "bubblewrap: ✓" in result.output
|
|
|
|
|
|
def test_doctor_reports_bwrap_missing():
|
|
"""Test that doctor reports bubblewrap as missing when not present."""
|
|
# Patch the single shutil.which used by both cli and registry
|
|
with patch.object(cli_module.shutil, "which", side_effect=_which({"tmux"})):
|
|
result = CliRunner().invoke(main, ["doctor"])
|
|
assert result.exit_code == 0
|
|
assert "bubblewrap: ✗" in result.output
|