unsloth start: narrow managed Node probe fallback
This commit is contained in:
parent
733fb9ba54
commit
d8793b66cf
2 changed files with 10 additions and 1 deletions
|
|
@ -2393,7 +2393,7 @@ def _managed_node_tools() -> Optional[tuple[Path, Path, bool]]:
|
|||
from utils.node_runtime import managed_node_binary, resolve_node_executable
|
||||
|
||||
node = Path(managed_node_binary())
|
||||
except Exception:
|
||||
except (ImportError, OSError, RuntimeError, TypeError, ValueError):
|
||||
return None
|
||||
npm = node.with_name("npm.cmd" if os.name == "nt" else "npm")
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -268,6 +268,15 @@ def test_npm_executable_uses_studio_managed_node(monkeypatch, tmp_path):
|
|||
assert start._npm_executable() == str(npm)
|
||||
|
||||
|
||||
def test_managed_node_probe_tolerates_unsupported_path_flavour(monkeypatch):
|
||||
def unsupported_backend_path():
|
||||
raise RuntimeError("unsupported path flavour")
|
||||
|
||||
monkeypatch.setattr(start, "ensure_studio_backend_path", unsupported_backend_path)
|
||||
|
||||
assert start._managed_node_tools() is None
|
||||
|
||||
|
||||
def test_npm_executable_uses_managed_npm_when_system_node_has_none(monkeypatch, tmp_path):
|
||||
start.ensure_studio_backend_path()
|
||||
from utils import node_runtime
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue