mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-11 15:31:37 +08:00
refactor: run tests with pytest
This commit is contained in:
@@ -6,10 +6,18 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
||||
)
|
||||
|
||||
func RunPytest(args []string) error {
|
||||
cmd := exec.Command("pytest", args...)
|
||||
python3, err := builtin.EnsurePython3Venv("httprunner")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "ensure python venv failed")
|
||||
}
|
||||
|
||||
args = append([]string{"-m", "httprunner", "run"}, args...)
|
||||
cmd := exec.Command(python3, args...)
|
||||
log.Info().Str("cmd", cmd.String()).Msg("run pytest")
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
|
||||
Reference in New Issue
Block a user