feat: add pytest sub-command to run pytest scripts

This commit is contained in:
debugtalk
2022-04-09 00:08:18 +08:00
parent 3e404da4b4
commit 7259d12562
6 changed files with 56 additions and 6 deletions
+24
View File
@@ -0,0 +1,24 @@
package cmd
import (
"github.com/spf13/cobra"
"github.com/httprunner/httprunner/hrp/internal/pytest"
)
var pytestCmd = &cobra.Command{
Use: "pytest $path ...",
Short: "run API test with pytest",
Args: cobra.MinimumNArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {
setLogLevel(logLevel)
},
DisableFlagParsing: true, // allow to pass any args to pytest
RunE: func(cmd *cobra.Command, args []string) error {
return pytest.RunPytest(args)
},
}
func init() {
rootCmd.AddCommand(pytestCmd)
}