From 1f871ac87b1fea61e4baf2891617625fe32655be Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 29 Jun 2026 04:31:58 +0200 Subject: [PATCH] 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 --- tests/integration/cmd_keys_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/cmd_keys_test.go b/tests/integration/cmd_keys_test.go index 91b0d1eea02..78a4789a8a8 100644 --- a/tests/integration/cmd_keys_test.go +++ b/tests/integration/cmd_keys_test.go @@ -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{