test: stop Test_CmdKeys from leaking re-initialized settings

Running the keys command in-process re-initializes settings, and since
cli v3.10 a usage error also prints help (which re-initializes them too).
That repointed the global RepoRootPath to a default under the data dir,
tripping the SyncDirs guard in every later integration test. Set
HideHelp so a usage error no longer prints help during the test.

Assisted-by: Claude:Opus-4.8
This commit is contained in:
silverwind
2026-06-29 04:31:58 +02:00
parent 22439e119b
commit 1f871ac87b

View File

@@ -38,7 +38,8 @@ func Test_CmdKeys(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
// FIXME: this test is not quite right. Each "command run" always re-initializes settings
keysCmd := cmd.NewKeysCommand()
keysCmd.Before = nil // don't re-initialize logger during the test
keysCmd.Before = nil // don't re-initialize logger during the test
keysCmd.HideHelp = true // skip help on usage error, which would re-initialize settings (cli v3.10)
var stdout, stderr bytes.Buffer
app := &cli.Command{