mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-03 14:59:38 +08:00
change: exit with InvalidPython3Venv code
This commit is contained in:
@@ -6,10 +6,12 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/httprunner/funplugin/myexec"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/code"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||
"github.com/httprunner/httprunner/v4/hrp/pkg/convert"
|
||||
)
|
||||
@@ -46,7 +48,7 @@ var convertCmd = &cobra.Command{
|
||||
_, err := myexec.EnsurePython3Venv(venv, packages...)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("python3 venv is not ready")
|
||||
return err
|
||||
return errors.Wrap(code.InvalidPython3Venv, err.Error())
|
||||
}
|
||||
|
||||
outputType = convert.OutputTypePyTest
|
||||
|
||||
@@ -6,9 +6,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/httprunner/funplugin/myexec"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/code"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/pytest"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||
@@ -35,7 +37,7 @@ var pytestCmd = &cobra.Command{
|
||||
_, err = myexec.EnsurePython3Venv(venv, packages...)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("python3 venv is not ready")
|
||||
return err
|
||||
return errors.Wrap(code.InvalidPython3Venv, err.Error())
|
||||
}
|
||||
return pytest.RunPytest(args)
|
||||
},
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/code"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/env"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||
@@ -216,7 +217,7 @@ func createPythonPlugin(projectName, venv string) error {
|
||||
}
|
||||
_, err = myexec.EnsurePython3Venv(venv, packages...)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(code.InvalidPython3Venv, err.Error())
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -73,7 +73,7 @@ func initPlugin(path, venv string, logOn bool) (plugin funplugin.IPlugin, err er
|
||||
log.Error().Err(err).
|
||||
Interface("packages", packages).
|
||||
Msg("python3 venv is not ready")
|
||||
return nil, err
|
||||
return nil, errors.Wrap(code.InvalidPython3Venv, err.Error())
|
||||
}
|
||||
pluginOptions = append(pluginOptions, funplugin.WithPython3(python3))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user