Skip to content

Commit

Permalink
skip deletion of venv when it has not been created yet
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwareus committed Oct 15, 2023
1 parent 64f1fde commit a5bd8c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/resolution/pm/pip/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ func (j *Job) Install() bool {
func (j *Job) Run() {
if j.install {
defer func() {
if j.venvPath == "" {
return
}
j.SendStatus("removing venv")
err := j.pipCleaner.RemoveAll(j.venvPath)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/resolution/pm/pip/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestRunInstallCmdErr(t *testing.T) {
cmdFactoryMock := testdata.NewEchoCmdFactory()
cmdFactoryMock.MakeInstallErr = cmdErr
fileWriterMock := &writerTestdata.FileWriterMock{}
j := NewJob("file", true, cmdFactoryMock, fileWriterMock, nil)
j := NewJob("file", true, cmdFactoryMock, fileWriterMock, pipCleaner{})

go jobTestdata.WaitStatus(j)
j.Run()
Expand Down

0 comments on commit a5bd8c4

Please sign in to comment.