mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:59:44 +08:00
change: venv priority: specified > /Users/debugtalk/.hrp/venv
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
# Release History
|
||||
|
||||
## v4.1.3 (2022-06-13)
|
||||
## v4.1.3 (2022-06-14)
|
||||
|
||||
**go version**
|
||||
|
||||
- feat #1342: support specify custom python3 venv
|
||||
- feat: support python3 venv priority, specified > projectDir/.venv > $HOME/.hrp/venv
|
||||
- feat #1342: support specify custom python3 venv, priority is greater than $HOME/.hrp/venv
|
||||
- feat: assert python3 package is ready with specified version
|
||||
- refactor: build plugin mechanism, cancel automatic installation of dependencies
|
||||
- fix: pip upgrade httprunner when installing hrp
|
||||
|
||||
@@ -178,7 +178,7 @@ func InstallPythonPackage(python3 string, pkg string) (err error) {
|
||||
return errors.Wrap(err, "pip is not available")
|
||||
}
|
||||
|
||||
log.Info().Str("package", pkg).Msg("installing python package")
|
||||
log.Info().Str("pkgName", pkgName).Str("pkgVersion", pkgVersion).Msg("installing python package")
|
||||
|
||||
// install package
|
||||
err = ExecCommand(python3, "-m", "pip", "install", "--upgrade", pkg,
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/httprunner/funplugin/fungo"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/httprunner/funplugin/fungo"
|
||||
"github.com/httprunner/httprunner/v4/hrp"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||
@@ -206,7 +206,11 @@ func createPythonPlugin(projectName, venv string) error {
|
||||
}
|
||||
|
||||
if venv == "" {
|
||||
venv = filepath.Join(projectName, ".venv")
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "get user home dir failed")
|
||||
}
|
||||
venv = filepath.Join(home, ".hrp", "venv")
|
||||
}
|
||||
log.Info().Str("venv", venv).Msg("create python3 venv")
|
||||
packages := []string{
|
||||
|
||||
@@ -49,10 +49,7 @@ func initPlugin(path, venv string, logOn bool) (plugin funplugin.IPlugin, err er
|
||||
}
|
||||
pluginPath = genPyPluginPath
|
||||
|
||||
// priority: specified > projectDir/.venv > $HOME/.hrp/venv
|
||||
if venv == "" && builtin.IsFolderPathExists(filepath.Join(filepath.Dir(pluginPath), ".venv")) {
|
||||
venv = filepath.Join(filepath.Dir(pluginPath), ".venv")
|
||||
}
|
||||
// priority: specified > $HOME/.hrp/venv
|
||||
err = builtin.PrepareVenv(venv)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("prepare python3 venv failed")
|
||||
|
||||
Reference in New Issue
Block a user