-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #258 from rstudio/mm-python-on-path
Python on path
- Loading branch information
Showing
4 changed files
with
170 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package util | ||
|
||
// Copyright (C) 2023 by Posit Software, PBC. | ||
|
||
import ( | ||
"os/exec" | ||
|
||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type PathLooker interface { | ||
LookPath(name string) (string, error) | ||
} | ||
|
||
type defaultPathLooker struct{} | ||
|
||
func NewPathLooker() PathLooker { | ||
return &defaultPathLooker{} | ||
} | ||
|
||
func (p *defaultPathLooker) LookPath(name string) (string, error) { | ||
return exec.LookPath(name) | ||
} | ||
|
||
type mockPathLooker struct { | ||
mock.Mock | ||
} | ||
|
||
func NewMockPathLooker() *mockPathLooker { | ||
return &mockPathLooker{} | ||
} | ||
|
||
func (m *mockPathLooker) LookPath(name string) (string, error) { | ||
args := m.Called(name) | ||
return args.String(0), args.Error(1) | ||
} |