first commit

This commit is contained in:
2024-10-13 17:28:37 +08:00
parent 5cb3424ad0
commit e151a7af0c
2 changed files with 18 additions and 4 deletions

View File

@ -5,6 +5,8 @@ from croterline.process import SubProcess, get_ctx
def p_func(*args, **kwargs):
print("Args", args)
print("Kwargs", kwargs)
i = 0
ctx = get_ctx()
while True:
@ -15,10 +17,16 @@ def p_func(*args, **kwargs):
ctx.sub_chan << "end"
def p_func2(*args, **kwargs):
print("args: ", args)
print("kwargs: ", kwargs)
raise Exception("Test")
class TestSubProcess:
def test_run(self):
print("start")
sp = SubProcess("test", p_func, Context())
sp = SubProcess("test", p_func, Context(), 1, 2, 3, k1=1, k2=2)
sp.start()
while True:
@ -30,5 +38,7 @@ class TestSubProcess:
print("finished")
sp.terminate()
def test_decorator(self):
pass
def test_input(self):
print("test_input")
sp = SubProcess("test2", p_func2, Context(), 1, 2, 3, host=1, port=2)
sp.start()