From ae1fd24459c31f5060cdd5720b0758fbdacc96f1 Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Fri, 12 Sep 2025 11:37:34 -0700 Subject: [PATCH 1/6] Fix TestUpdateIntegrationTestSuite/TestLockUnlock --- pkg/projectfile/projectfile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/projectfile/projectfile.go b/pkg/projectfile/projectfile.go index 128e01d95a..e4b53d8f19 100644 --- a/pkg/projectfile/projectfile.go +++ b/pkg/projectfile/projectfile.go @@ -1130,7 +1130,7 @@ func AddLockInfo(projectFilePath, branch, version string) error { projectRegex := regexp.MustCompile(fmt.Sprintf("(?m:(^project:\\s*%s))", ProjectURLRe)) lockString := fmt.Sprintf("%s@%s", branch, version) - lockUpdate := []byte(fmt.Sprintf(`${1}\nlock: %s`, lockString)) + lockUpdate := []byte(fmt.Sprintf("${1}\nlock: %s", lockString)) data, err = os.ReadFile(projectFilePath) if err != nil { From 728a46b24ab8b077f4d12e149cfdf956161c9e95 Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Fri, 12 Sep 2025 11:37:51 -0700 Subject: [PATCH 2/6] Fix TestPublishIntegrationTestSuite/TestPublish --- test/integration/publish_int_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/publish_int_test.go b/test/integration/publish_int_test.go index a8963c8724..e862a75221 100644 --- a/test/integration/publish_int_test.go +++ b/test/integration/publish_int_test.go @@ -136,7 +136,7 @@ func (suite *PublishIntegrationTestSuite) TestPublish() { }, expect{ []string{}, - "Expected file extension to be either", + "Expected file extension", true, 1, true, From c3969f38ddedd9823dadaa14c358b38e55e414da Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Fri, 12 Sep 2025 11:51:39 -0700 Subject: [PATCH 3/6] Fix TestUseIntegrationTestSuite/TestReset --- test/integration/use_int_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/integration/use_int_test.go b/test/integration/use_int_test.go index d9b781eaab..e89fb3b518 100644 --- a/test/integration/use_int_test.go +++ b/test/integration/use_int_test.go @@ -7,7 +7,6 @@ import ( "runtime" "testing" - "github.com/ActiveState/cli/internal/config" "github.com/ActiveState/cli/internal/fileutils" "github.com/ActiveState/cli/internal/locale" "github.com/ActiveState/cli/internal/osutils" @@ -124,12 +123,14 @@ func (suite *UseIntegrationTestSuite) TestReset() { python3Exe := filepath.Join(ts.Dirs.DefaultBin, "python3"+osutils.ExeExtension) suite.True(fileutils.TargetExists(python3Exe), python3Exe+" not found") - cfg, err := config.New() - suite.NoError(err) - rcfile, err := subshell.New(cfg).RcFile() - if runtime.GOOS != "windows" && fileutils.FileExists(rcfile) { + var rcfile string + ts.WithEnv(func() { + var err error + rcfile, err = subshell.New(ts.Config()).RcFile() suite.NoError(err) - suite.Contains(string(fileutils.ReadFileUnsafe(rcfile)), ts.Dirs.DefaultBin, "PATH does not have your project in it") + }) + if runtime.GOOS != "windows" && fileutils.FileExists(rcfile) { + suite.Contains(string(fileutils.ReadFileUnsafe(rcfile)), ts.Dirs.DefaultBin, ts.DebugMessage("PATH does not have your project in it")) } cp = ts.Spawn("use", "reset") From 53dcb74b62dbfb0e326e45ac31cebeb421a883b3 Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Mon, 15 Sep 2025 11:01:32 -0700 Subject: [PATCH 4/6] Log closure of logging for debugging purposes --- internal/logging/file.go | 2 ++ internal/logging/logging.go | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/logging/file.go b/internal/logging/file.go index 09ba03011f..0259146462 100644 --- a/internal/logging/file.go +++ b/internal/logging/file.go @@ -151,6 +151,8 @@ func (l *fileHandler) Close() { return } + l.Emit(getContext("DEBUG", 1), "Closing logging handler") + close(l.quit) l.wg.Wait() diff --git a/internal/logging/logging.go b/internal/logging/logging.go index 1ac62a772b..7c445f0af3 100644 --- a/internal/logging/logging.go +++ b/internal/logging/logging.go @@ -38,9 +38,9 @@ const ( WARNING = 4 WARN = 4 ERROR = 8 - NOTICE = 16 //notice is like info but for really important stuff ;) + NOTICE = 16 // notice is like info but for really important stuff ;) CRITICAL = 32 - QUIET = ERROR | NOTICE | CRITICAL //setting for errors only + QUIET = ERROR | NOTICE | CRITICAL // setting for errors only NORMAL = INFO | WARN | ERROR | NOTICE | CRITICAL // default setting - all besides debug ALL = 255 NOTHING = 0 @@ -158,7 +158,9 @@ func (l *standardHandler) Printf(msg string, args ...interface{}) { l.Emit(getContext("DBG", 1), logMsg, args...) } -func (l *standardHandler) Close() {} +func (l *standardHandler) Close() { + l.Emit(getContext("DEBUG", 1), "Closing logging handler") +} var currentHandler LoggingHandler = &standardHandler{ DefaultFormatter, From 9c71d62f6f4283b3bb1febcc82cc19454661d561 Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Tue, 16 Sep 2025 09:30:08 -0700 Subject: [PATCH 5/6] Force EDITOR env var --- test/integration/publish_int_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/integration/publish_int_test.go b/test/integration/publish_int_test.go index e862a75221..2194930f8a 100644 --- a/test/integration/publish_int_test.go +++ b/test/integration/publish_int_test.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "regexp" + "runtime" "testing" "time" @@ -32,6 +33,14 @@ func (suite *PublishIntegrationTestSuite) TestPublish() { // For development convenience, should not be committed without commenting out.. // os.Setenv(constants.APIHostEnvVarName, "pr13375.activestate.build") + // Set EDITOR environment variable for testing purposes + if runtime.GOOS == "windows" { + suite.Require().NoError(os.Setenv("EDITOR", "notepad.exe")) + } else { + suite.Require().NoError(os.Setenv("EDITOR", "nano")) + } + defer os.Unsetenv("EDITOR") + type input struct { args []string metafile *string From 1036fea0d912c31617c4f54a3f9a32e22704688f Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Tue, 16 Sep 2025 13:16:14 -0700 Subject: [PATCH 6/6] Only assert RC file on non-windows platforms --- test/integration/use_int_test.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/integration/use_int_test.go b/test/integration/use_int_test.go index e89fb3b518..1116067da5 100644 --- a/test/integration/use_int_test.go +++ b/test/integration/use_int_test.go @@ -123,13 +123,14 @@ func (suite *UseIntegrationTestSuite) TestReset() { python3Exe := filepath.Join(ts.Dirs.DefaultBin, "python3"+osutils.ExeExtension) suite.True(fileutils.TargetExists(python3Exe), python3Exe+" not found") - var rcfile string - ts.WithEnv(func() { - var err error - rcfile, err = subshell.New(ts.Config()).RcFile() - suite.NoError(err) - }) - if runtime.GOOS != "windows" && fileutils.FileExists(rcfile) { + if runtime.GOOS != "windows" { + var rcfile string + ts.WithEnv(func() { + var err error + rcfile, err = subshell.New(ts.Config()).RcFile() + suite.NoError(err) + }) + suite.Require().FileExists(rcfile) suite.Contains(string(fileutils.ReadFileUnsafe(rcfile)), ts.Dirs.DefaultBin, ts.DebugMessage("PATH does not have your project in it")) }