change: lock funplugin version when creating scaffold project

This commit is contained in:
debugtalk
2022-03-27 11:13:03 +08:00
parent 878d009d76
commit cec3c31775
4 changed files with 16 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
- feat: add `--profile` flag for har2case to support overwrite headers/cookies with specified yaml/json profile file
- change: integrate [sentry sdk][sentry sdk] for panic reporting and analysis
- change: lock funplugin version when creating scaffold project
- fix: call referenced api/testcase with relative path
**python version**

2
go.mod
View File

@@ -7,7 +7,7 @@ require (
github.com/denisbrodbeck/machineid v1.0.1
github.com/getsentry/sentry-go v0.13.0
github.com/google/uuid v1.3.0
github.com/httprunner/funplugin v0.4.0
github.com/httprunner/funplugin v0.4.2
github.com/jinzhu/copier v0.3.2
github.com/jmespath/go-jmespath v0.4.0
github.com/json-iterator/go v1.1.12

4
go.sum
View File

@@ -240,8 +240,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/httprunner/funplugin v0.4.0 h1:jSptZ6Ki0Dh3uvpLDbmxE6kSqVv0FHaQnHs0Qt+6SS8=
github.com/httprunner/funplugin v0.4.0/go.mod h1:vPyeJIfbpGe0epZZtAV0wCn16gLY9+imSw/zfxq0Lcc=
github.com/httprunner/funplugin v0.4.2 h1:iDeg3GVCKdimgZQ40xq0kxHqhL/DQmRxs3DRjzOpUuo=
github.com/httprunner/funplugin v0.4.2/go.mod h1:vPyeJIfbpGe0epZZtAV0wCn16gLY9+imSw/zfxq0Lcc=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=

View File

@@ -148,7 +148,9 @@ func createGoPlugin(projectName string) error {
}
// download plugin dependency
if err := builtin.ExecCommand(exec.Command("go", "get", "github.com/httprunner/funplugin"), pluginDir); err != nil {
// funplugin version should be locked
funplugin := fmt.Sprintf("github.com/httprunner/funplugin@%s", shared.Version)
if err := builtin.ExecCommand(exec.Command("go", "get", funplugin), pluginDir); err != nil {
return err
}
@@ -167,12 +169,18 @@ func createPythonPlugin(projectName string) error {
pluginFile := filepath.Join(projectName, "debugtalk.py")
err := CopyFile("templates/plugin/debugtalk.py", pluginFile)
if err != nil {
return err
return errors.Wrap(err, "copy file failed")
}
// create python venv
if _, err := shared.PreparePython3Venv(pluginFile); err != nil {
return err
home, err := os.UserHomeDir()
if err != nil {
return errors.Wrap(err, "get user home dir failed")
}
venvDir := filepath.Join(home, ".hrp", "venv")
_, err = shared.EnsurePython3Venv(venvDir)
if err != nil {
return errors.Wrap(err, "ensure python venv failed")
}
return nil