refactor: EnsurePython3Venv

This commit is contained in:
debugtalk
2022-06-14 11:52:18 +08:00
parent d91eba501c
commit c00dab17b3
20 changed files with 60 additions and 88 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
package scaffold
import (
"path/filepath"
"testing"
)
@@ -12,7 +13,8 @@ func TestGenDemoExamples(t *testing.T) {
}
dir = "../../../examples/demo-with-py-plugin"
err = CreateScaffold(dir, Py, "", true)
venv := filepath.Join(dir, ".venv")
err = CreateScaffold(dir, Py, venv, true)
if err != nil {
t.Fatal()
}
-8
View File
@@ -205,14 +205,6 @@ func createPythonPlugin(projectName, venv string) error {
return errors.Wrap(err, "copy file failed")
}
if 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{
fmt.Sprintf("funppy==%s", fungo.Version),
fmt.Sprintf("httprunner==%s", version.VERSION),