Skip to content

Commit 58a6855

Browse files
committed
Fix more tests
1 parent aeee917 commit 58a6855

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

test/integration/deploy_int_test.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
"github.com/ActiveState/cli/internal/testhelpers/suite"
1414

15-
"github.com/ActiveState/cli/internal/config"
1615
"github.com/ActiveState/cli/internal/constants"
1716
"github.com/ActiveState/cli/internal/fileutils"
1817
"github.com/ActiveState/cli/internal/subshell"
@@ -207,7 +206,9 @@ func (suite *DeployIntegrationTestSuite) TestDeployPython() {
207206
cp.SendLine("exit")
208207
cp.ExpectExitCode(0)
209208

210-
suite.AssertConfig(ts, targetID.String())
209+
ts.WithEnv(func() {
210+
suite.AssertConfig(ts, targetID.String())
211+
})
211212
}
212213

213214
func (suite *DeployIntegrationTestSuite) TestDeployInstall() {
@@ -294,17 +295,17 @@ func (suite *DeployIntegrationTestSuite) TestDeployConfigure() {
294295
func (suite *DeployIntegrationTestSuite) AssertConfig(ts *e2e.Session, targetID string) {
295296
if runtime.GOOS != "windows" {
296297
// Test config file
297-
cfg, err := config.New()
298-
suite.Require().NoError(err)
299298

300-
subshell := subshell.New(cfg)
301-
rcFile, err := subshell.RcFile()
302-
suite.Require().NoError(err)
299+
ts.WithEnv(func() {
300+
subshell := subshell.New(ts.Config())
301+
rcFile, err := subshell.RcFile()
302+
suite.Require().NoError(err)
303303

304-
bashContents := fileutils.ReadFileUnsafe(rcFile)
305-
suite.Contains(string(bashContents), constants.RCAppendDeployStartLine, "config file should contain our RC Append Start line")
306-
suite.Contains(string(bashContents), constants.RCAppendDeployStopLine, "config file should contain our RC Append Stop line")
307-
suite.Contains(string(bashContents), targetID, "config file should contain our target dir")
304+
bashContents := fileutils.ReadFileUnsafe(rcFile)
305+
suite.Contains(string(bashContents), constants.RCAppendDeployStartLine, "config file should contain our RC Append Start line")
306+
suite.Contains(string(bashContents), constants.RCAppendDeployStopLine, "config file should contain our RC Append Stop line")
307+
suite.Contains(string(bashContents), targetID, "config file should contain our target dir")
308+
})
308309
} else {
309310
// Test registry
310311
out, err := exec.Command("reg", "query", `HKLM\SYSTEM\ControlSet001\Control\Session Manager\Environment`, "/v", "Path").Output()

test/integration/use_int_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,16 @@ func (suite *UseIntegrationTestSuite) TestReset() {
127127
python3Exe := filepath.Join(ts.Dirs.DefaultBin, "python3"+osutils.ExeExtension)
128128
suite.True(fileutils.TargetExists(python3Exe), python3Exe+" not found")
129129

130-
cfg, err := config.New()
131-
suite.NoError(err)
132-
rcfile, err := subshell.New(cfg).RcFile()
133-
if runtime.GOOS != "windows" && fileutils.FileExists(rcfile) {
130+
var rcfile string
131+
ts.WithEnv(func() {
132+
cfg, err := config.New()
134133
suite.NoError(err)
135-
suite.Contains(string(fileutils.ReadFileUnsafe(rcfile)), ts.Dirs.DefaultBin, "PATH does not have your project in it")
136-
}
134+
rcfile, err := subshell.New(cfg).RcFile()
135+
if runtime.GOOS != "windows" && fileutils.FileExists(rcfile) {
136+
suite.NoError(err)
137+
suite.Contains(string(fileutils.ReadFileUnsafe(rcfile)), ts.Dirs.DefaultBin, "PATH does not have your project in it")
138+
}
139+
})
137140

138141
cp = ts.Spawn("use", "reset")
139142
cp.Expect("Continue?")

0 commit comments

Comments
 (0)