(paths ...string)
| 11 | ) |
| 12 | |
| 13 | func convert2GoTestScripts(paths ...string) error { |
| 14 | log.Warn().Msg("convert to gotest scripts is not supported yet") |
| 15 | os.Exit(1) |
| 16 | |
| 17 | // TODO |
| 18 | var testCasePaths []hrp.ITestCase |
| 19 | for _, path := range paths { |
| 20 | testCasePath := hrp.TestCasePath(path) |
| 21 | testCasePaths = append(testCasePaths, &testCasePath) |
| 22 | } |
| 23 | |
| 24 | testCases, err := hrp.LoadTestCases(testCasePaths...) |
| 25 | if err != nil { |
| 26 | log.Error().Err(err).Msg("failed to load testcases") |
| 27 | return err |
| 28 | } |
| 29 | |
| 30 | var pytestPaths []string |
| 31 | for _, testCase := range testCases { |
| 32 | tc := testCase.ToTCase() |
| 33 | converter := TCaseConverter{ |
| 34 | tCase: tc, |
| 35 | } |
| 36 | pytestPath, err := converter.toPyTest() |
| 37 | if err != nil { |
| 38 | log.Error().Err(err). |
| 39 | Str("originPath", tc.Config.Path). |
| 40 | Msg("convert to pytest failed") |
| 41 | continue |
| 42 | } |
| 43 | log.Info(). |
| 44 | Str("pytestPath", pytestPath). |
| 45 | Str("originPath", tc.Config.Path). |
| 46 | Msg("convert to pytest success") |
| 47 | pytestPaths = append(pytestPaths, pytestPath) |
| 48 | } |
| 49 | |
| 50 | // format pytest scripts with black |
| 51 | return myexec.ExecPython3Command("black", pytestPaths...) |
| 52 | } |
| 53 | |
| 54 | //go:embed testcase.tmpl |
| 55 | var testcaseTemplate string |
nothing calls this directly
no test coverage detected