mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-06 23:11:21 +08:00
refactor: rename debugtalk_gen.py to .debugtalk_gen.py
This commit is contained in:
@@ -32,7 +32,7 @@ const (
|
||||
|
||||
const (
|
||||
genDebugTalkGo = "debugtalk_gen.go"
|
||||
genDebugTalkPy = "debugtalk_gen.py"
|
||||
genDebugTalkPy = ".debugtalk_gen.py"
|
||||
)
|
||||
|
||||
//go:embed templates/debugtalkPythonTemplate
|
||||
|
||||
@@ -15,13 +15,13 @@ func TestRun(t *testing.T) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
genDebugTalkPy := "../scaffold/templates/plugin/debugtalk_gen.py"
|
||||
err = Run("../scaffold/templates/plugin/debugtalk.py", genDebugTalkPy)
|
||||
genDebugTalkPyPath := "../scaffold/templates/plugin/" + genDebugTalkPy
|
||||
err = Run("../scaffold/templates/plugin/debugtalk.py", genDebugTalkPyPath)
|
||||
if !assert.Nil(t, err) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
contentBytes, err := builtin.ReadFile(genDebugTalkPy)
|
||||
contentBytes, err := builtin.ReadFile(genDebugTalkPyPath)
|
||||
if !assert.Nil(t, err) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
75
hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py
Normal file
75
hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py
Normal file
@@ -0,0 +1,75 @@
|
||||
# NOTE: Generated By hrp v4.1.0, DO NOT EDIT!
|
||||
|
||||
import logging
|
||||
import time
|
||||
import funppy
|
||||
|
||||
from typing import List
|
||||
|
||||
|
||||
def get_user_agent():
|
||||
return "hrp/funppy"
|
||||
|
||||
|
||||
def sleep(n_secs):
|
||||
time.sleep(n_secs)
|
||||
|
||||
|
||||
def sum(*args):
|
||||
result = 0
|
||||
for arg in args:
|
||||
result += arg
|
||||
return result
|
||||
|
||||
|
||||
def sum_ints(*args: List[int]) -> int:
|
||||
result = 0
|
||||
for arg in args:
|
||||
result += arg
|
||||
return result
|
||||
|
||||
|
||||
def sum_two_int(a: int, b: int) -> int:
|
||||
return a + b
|
||||
|
||||
|
||||
def sum_two_string(a: str, b: str) -> str:
|
||||
return a + b
|
||||
|
||||
|
||||
def sum_strings(*args: List[str]) -> str:
|
||||
result = ""
|
||||
for arg in args:
|
||||
result += arg
|
||||
return result
|
||||
|
||||
|
||||
def concatenate(*args: List[str]) -> str:
|
||||
result = ""
|
||||
for arg in args:
|
||||
result += str(arg)
|
||||
return result
|
||||
|
||||
|
||||
def setup_hook_example(name):
|
||||
logging.warning("setup_hook_example")
|
||||
return f"setup_hook_example: {name}"
|
||||
|
||||
|
||||
def teardown_hook_example(name):
|
||||
logging.warning("teardown_hook_example")
|
||||
return f"teardown_hook_example: {name}"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
funppy.register("get_user_agent", get_user_agent)
|
||||
funppy.register("sleep", sleep)
|
||||
funppy.register("sum", sum)
|
||||
funppy.register("sum_ints", sum_ints)
|
||||
funppy.register("sum_two_int", sum_two_int)
|
||||
funppy.register("sum_two_string", sum_two_string)
|
||||
funppy.register("sum_strings", sum_strings)
|
||||
funppy.register("concatenate", concatenate)
|
||||
funppy.register("setup_hook_example", setup_hook_example)
|
||||
funppy.register("teardown_hook_example", teardown_hook_example)
|
||||
funppy.serve()
|
||||
Reference in New Issue
Block a user