mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-30 04:21:19 -08:00
fix(python): do not validate empty env
This commit is contained in:
parent
6c45afa89a
commit
266fc5671f
|
@ -70,6 +70,9 @@ func (p *Python) loadContext() {
|
|||
var venv string
|
||||
for _, venvVar := range venvVars {
|
||||
venv = p.language.env.Getenv(venvVar)
|
||||
if len(venv) == 0 {
|
||||
continue
|
||||
}
|
||||
name := environment.Base(p.language.env, venv)
|
||||
if p.canUseVenvName(name) {
|
||||
p.Venv = name
|
||||
|
@ -83,9 +86,6 @@ func (p *Python) inContext() bool {
|
|||
}
|
||||
|
||||
func (p *Python) canUseVenvName(name string) bool {
|
||||
if name == "" || name == "." {
|
||||
return false
|
||||
}
|
||||
if p.language.props.GetBool(properties.DisplayDefault, true) {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ func TestPythonPythonInContext(t *testing.T) {
|
|||
for _, tc := range cases {
|
||||
env := new(mock.MockedEnvironment)
|
||||
env.On("GOOS").Return("")
|
||||
env.On("PathSeparator").Return("")
|
||||
env.On("PathSeparator").Return("/")
|
||||
env.On("Getenv", "VIRTUAL_ENV").Return(tc.VirtualEnvName)
|
||||
env.On("Getenv", "CONDA_ENV_PATH").Return("")
|
||||
env.On("Getenv", "CONDA_DEFAULT_ENV").Return("")
|
||||
|
|
Loading…
Reference in a new issue