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, 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 { diff --git a/test/integration/publish_int_test.go b/test/integration/publish_int_test.go index 6c2a0ea79f..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 @@ -136,7 +145,7 @@ func (suite *PublishIntegrationTestSuite) TestPublish() { }, expect{ []string{}, - "Expected file extension:", + "Expected file extension", true, 1, true, diff --git a/test/integration/use_int_test.go b/test/integration/use_int_test.go index d9b781eaab..1116067da5 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,15 @@ 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) { - suite.NoError(err) - suite.Contains(string(fileutils.ReadFileUnsafe(rcfile)), ts.Dirs.DefaultBin, "PATH does not have your project in it") + 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")) } cp = ts.Spawn("use", "reset")