mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:59:44 +08:00
fix: default output debugtalk_gen.py by building debugtalk.py
This commit is contained in:
@@ -261,9 +261,9 @@ func buildPy(path string, output string) error {
|
||||
// generate debugtalk.py
|
||||
if output == "" {
|
||||
dir, _ := os.Getwd()
|
||||
output = filepath.Join(dir, "debugtalk.py")
|
||||
output = filepath.Join(dir, "debugtalk_gen.py")
|
||||
} else if builtin.IsFolderPathExists(output) {
|
||||
output = filepath.Join(output, "debugtalk.py")
|
||||
output = filepath.Join(output, "debugtalk_gen.py")
|
||||
}
|
||||
err = templateContent.genDebugTalk(output, pyTemplate)
|
||||
if err != nil {
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestRun(t *testing.T) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
err = Run("examples/debugtalk_no_funppy.py", "./debugtalk_gen.py")
|
||||
err = Run("examples/debugtalk_no_funppy.py", "./debugtalk.py")
|
||||
if !assert.Nil(t, err) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
goPluginFile = "debugtalk.so" // built from go plugin
|
||||
hashicorpGoPluginFile = "debugtalk.bin" // built from hashicorp go plugin
|
||||
hashicorpPyPluginFile = "debugtalk.py" // used for hashicorp python plugin
|
||||
projectInfoFile = "proj.json" // used for ensuring root project
|
||||
goPluginFile = "debugtalk.so" // built from go plugin
|
||||
hashicorpGoPluginFile = "debugtalk.bin" // built from hashicorp go plugin
|
||||
hashicorpPyPluginFile = "debugtalk_gen.py" // used for hashicorp python plugin, automatically generated by HRP
|
||||
debugtalkPyFile = "debugtalk.py" // write by user
|
||||
)
|
||||
|
||||
func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, pluginDir string, err error) {
|
||||
@@ -62,7 +62,7 @@ func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, pluginDir st
|
||||
}
|
||||
|
||||
func locatePlugin(path string) (pluginPath string, err error) {
|
||||
// priority: hashicorp plugin (debugtalk.bin > debugtalk.py) > go plugin (debugtalk.so)
|
||||
// priority: hashicorp plugin (debugtalk.bin > debugtalk_gen.py > debugtalk.py) > go plugin (debugtalk.so)
|
||||
|
||||
pluginPath, err = locateFile(path, hashicorpGoPluginFile)
|
||||
if err == nil {
|
||||
@@ -74,6 +74,11 @@ func locatePlugin(path string) (pluginPath string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
pluginPath, err = locateFile(path, debugtalkPyFile)
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
pluginPath, err = locateFile(path, goPluginFile)
|
||||
if err == nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user