mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-07 23:41:22 +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
|
// generate debugtalk.py
|
||||||
if output == "" {
|
if output == "" {
|
||||||
dir, _ := os.Getwd()
|
dir, _ := os.Getwd()
|
||||||
output = filepath.Join(dir, "debugtalk.py")
|
output = filepath.Join(dir, "debugtalk_gen.py")
|
||||||
} else if builtin.IsFolderPathExists(output) {
|
} else if builtin.IsFolderPathExists(output) {
|
||||||
output = filepath.Join(output, "debugtalk.py")
|
output = filepath.Join(output, "debugtalk_gen.py")
|
||||||
}
|
}
|
||||||
err = templateContent.genDebugTalk(output, pyTemplate)
|
err = templateContent.genDebugTalk(output, pyTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func TestRun(t *testing.T) {
|
|||||||
t.Fatal()
|
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) {
|
if !assert.Nil(t, err) {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
goPluginFile = "debugtalk.so" // built from go plugin
|
goPluginFile = "debugtalk.so" // built from go plugin
|
||||||
hashicorpGoPluginFile = "debugtalk.bin" // built from hashicorp go plugin
|
hashicorpGoPluginFile = "debugtalk.bin" // built from hashicorp go plugin
|
||||||
hashicorpPyPluginFile = "debugtalk.py" // used for hashicorp python plugin
|
hashicorpPyPluginFile = "debugtalk_gen.py" // used for hashicorp python plugin, automatically generated by HRP
|
||||||
projectInfoFile = "proj.json" // used for ensuring root project
|
debugtalkPyFile = "debugtalk.py" // write by user
|
||||||
)
|
)
|
||||||
|
|
||||||
func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, pluginDir string, err error) {
|
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) {
|
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)
|
pluginPath, err = locateFile(path, hashicorpGoPluginFile)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -74,6 +74,11 @@ func locatePlugin(path string) (pluginPath string, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pluginPath, err = locateFile(path, debugtalkPyFile)
|
||||||
|
if err == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
pluginPath, err = locateFile(path, goPluginFile)
|
pluginPath, err = locateFile(path, goPluginFile)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user