mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-15 12:27:59 +08:00
26 lines
606 B
Go
26 lines
606 B
Go
package pytest
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
|
"github.com/httprunner/httprunner/hrp/internal/sdk"
|
|
"github.com/httprunner/httprunner/hrp/internal/version"
|
|
)
|
|
|
|
func RunPytest(args []string) error {
|
|
sdk.SendEvent(sdk.EventTracking{
|
|
Category: "RunAPITests",
|
|
Action: "hrp pytest",
|
|
})
|
|
|
|
httprunner := fmt.Sprintf("httprunner>=%s", version.HttpRunnerMinVersion)
|
|
python3, err := builtin.EnsurePython3Venv(httprunner)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
args = append([]string{"-m", "httprunner", "run"}, args...)
|
|
return builtin.ExecCommand(python3, args...)
|
|
}
|