mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-09 09:49:33 +08:00
feat #1342: support specify custom python3 venv
This commit is contained in:
@@ -48,12 +48,7 @@ func convert2GoTestScripts(paths ...string) error {
|
||||
}
|
||||
|
||||
// format pytest scripts with black
|
||||
python3, err := builtin.EnsurePython3Venv("black")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args := append([]string{"-m", "black"}, pytestPaths...)
|
||||
return builtin.ExecCommand(python3, args...)
|
||||
return builtin.ExecPython3Command("black", pytestPaths...)
|
||||
}
|
||||
|
||||
//go:embed testcase.tmpl
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package convert
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||
)
|
||||
|
||||
func NewConverterJSON(converter *TCaseConverter) *ConverterJSON {
|
||||
@@ -51,7 +48,7 @@ func (c *ConverterJSON) ToYAML() (string, error) {
|
||||
}
|
||||
|
||||
func (c *ConverterJSON) ToGoTest() (string, error) {
|
||||
//TODO implement me
|
||||
// TODO implement me
|
||||
return "", errors.New("convert from json testcase to gotest scripts is not supported yet")
|
||||
}
|
||||
|
||||
@@ -60,13 +57,8 @@ func (c *ConverterJSON) ToPyTest() (string, error) {
|
||||
}
|
||||
|
||||
func (c *ConverterJSON) MakePyTestScript() (string, error) {
|
||||
httprunner := fmt.Sprintf("httprunner>=%s", version.HttpRunnerMinVersion)
|
||||
python3, err := builtin.EnsurePython3Venv(httprunner)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
args := append([]string{"-m", "httprunner", "make"}, c.converter.InputPath)
|
||||
err = builtin.ExecCommand(python3, args...)
|
||||
args := append([]string{"make"}, c.converter.InputPath)
|
||||
err := builtin.ExecPython3Command("httprunner", args...)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
package convert
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||
)
|
||||
|
||||
func convert2PyTestScripts(paths ...string) error {
|
||||
httprunner := fmt.Sprintf("httprunner>=%s", version.HttpRunnerMinVersion)
|
||||
python3, err := builtin.EnsurePython3Venv(httprunner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
args := append([]string{"-m", "httprunner", "make"}, paths...)
|
||||
return builtin.ExecCommand(python3, args...)
|
||||
args := append([]string{"make"}, paths...)
|
||||
return builtin.ExecPython3Command("httprunner", args...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user