mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-18 04:37:38 +08:00
24 lines
418 B
Go
24 lines
418 B
Go
package pytest
|
|
|
|
import (
|
|
"os/exec"
|
|
"strings"
|
|
|
|
"github.com/pkg/errors"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func RunPytest(args []string) error {
|
|
cmd := exec.Command("pytest", args...)
|
|
log.Info().Str("cmd", cmd.String()).Msg("run pytest")
|
|
|
|
output, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
return errors.Wrap(err, "pytest running failed")
|
|
}
|
|
out := strings.TrimSpace(string(output))
|
|
println(out)
|
|
|
|
return nil
|
|
}
|