test(cron): bot-chat CLI-home test strips the launcher prefix without requiring -p
The fixture adaptation for the `python -m hermes_cli.main` launcher located the
CLI argv via `argv.index("-p")`, but profile homes (`profiles/<name>`) never get
a `-p` flag appended, so the `beta` parametrization raised ValueError inside the
fake subprocess.run and the delivery reported failure. Strip the launcher prefix
by shape instead (3 tokens for `python -m hermes_cli.main`, 1 for a binary).
This commit is contained in:
@@ -35,7 +35,8 @@ def test_cli_keeps_discovered_home_when_launch_selection_changes(tmp_path, monke
|
||||
'import hermes_cli.main; from hermes_constants import get_hermes_home; '
|
||||
'print(json.dumps(str(get_hermes_home())))')
|
||||
# Everything after the launcher (binary or ``python -m hermes_cli.main``) is the CLI argv.
|
||||
result = real_run([sys.executable, "-c", code, json.dumps(argv[argv.index("-p"):])],
|
||||
cli_argv = argv[3:] if argv[1:3] == ["-m", "hermes_cli.main"] else argv[1:]
|
||||
result = real_run([sys.executable, "-c", code, json.dumps(cli_argv)],
|
||||
env=kwargs["env"], capture_output=True, text=True, timeout=30)
|
||||
assert result.returncode == 0, result.stderr
|
||||
seen.append(Path(json.loads(result.stdout.strip().splitlines()[-1])))
|
||||
|
||||
Reference in New Issue
Block a user