feat: check if specified python3 venv is invalid

This commit is contained in:
debugtalk
2022-06-13 23:54:47 +08:00
parent d7c1444327
commit cc5663ddec
2 changed files with 11 additions and 6 deletions

View File

@@ -9,6 +9,10 @@
- refactor: build plugin mechanism - refactor: build plugin mechanism
- fix: pip upgrade httprunner when installing hrp - fix: pip upgrade httprunner when installing hrp
**python version**
fix: unexpected changes in step variables
## v4.1.2 (2022-06-09) ## v4.1.2 (2022-06-09)
- feat: add Dockerfile - feat: add Dockerfile

View File

@@ -92,13 +92,14 @@ func FormatResponse(raw interface{}) interface{} {
var Python3Executable string = "python3" // system default python3 var Python3Executable string = "python3" // system default python3
func PrepareVenv(venv string) error { func PrepareVenv(venv string) error {
defer func() {
log.Info().Str("Python3Executable", Python3Executable).Msg("set python3 executable path")
}()
// specify python3 venv // specify python3 venv
if venv != "" { if venv != "" {
Python3Executable = getPython3Executable(venv) python3 := getPython3Executable(venv)
if !IsFilePathExists(python3) {
return errors.New("specified python3 venv is invalid")
}
Python3Executable = python3
log.Info().Str("Python3Executable", Python3Executable).Msg("set python3 executable path")
return nil return nil
} }
@@ -108,7 +109,7 @@ func PrepareVenv(venv string) error {
return errors.Wrap(err, "create default python3 venv failed") return errors.Wrap(err, "create default python3 venv failed")
} }
Python3Executable = python3 Python3Executable = python3
log.Info().Str("Python3Executable", Python3Executable).Msg("set python3 executable path")
return nil return nil
} }