File tree Expand file tree Collapse file tree 3 files changed +25
-13
lines changed
Expand file tree Collapse file tree 3 files changed +25
-13
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,10 @@ _async_done_ = [False]
7272_ret_code = [0]
7373async def main_runner():
7474 try:
75- _ret_code[0] = await main()
75+ ret = await main()
76+ if ret is None:
77+ ret = 0
78+ _ret_code[0] = ret
7679 except Exception as e:
7780 _ret_code[0] = 1
7881 print("EXCEPTION",e)
Original file line number Diff line number Diff line change @@ -43,7 +43,10 @@ _async_done_ = [False]
4343_ret_code = [0]
4444async def main_runner():
4545 try:
46- _ret_code[0] = await main()
46+ ret = await main()
47+ if ret is None:
48+ ret = 0
49+ _ret_code[0] = ret
4750 except Exception as e:
4851 _ret_code[0] = 1
4952 print("EXCEPTION",e)
Original file line number Diff line number Diff line change @@ -44,13 +44,11 @@ def test_sync_err(
4444 result = runner .invoke (app , cli_args )
4545 assert result .exit_code == 1
4646
47- @pytest .mark .parametrize ("execution_number" , range (1 ))
4847 def test_async_error (
4948 self ,
5049 env_prefix ,
5150 em_work_dir ,
5251 backend_cli_settings ,
53- execution_number ,
5452 tmpdir ,
5553 runner ,
5654 ):
@@ -111,27 +109,35 @@ def test_sync_hello_world(
111109 assert result .exit_code == 0
112110 assert "hello world" in result .stdout
113111
114- @pytest .mark .parametrize ("execution_number " , range ( 1 ) )
112+ @pytest .mark .parametrize ("with_return " , [ False , True ] )
115113 def test_async_hello_world (
116114 self ,
117115 env_prefix ,
118116 em_work_dir ,
119117 backend_cli_settings ,
120- execution_number ,
118+ with_return ,
121119 tmpdir ,
122120 runner ,
123121 ):
124122 to_mount_dir = tmpdir
125123 cli_mount = f"{ str (tmpdir )} :{ str (em_work_dir )} "
126124 backend_type , backend_args = backend_cli_settings
127125
128- main_content = """\n
129- import asyncio
130- async def main():
131- await asyncio.sleep(1)
132- print('hello world')
133- return 0
134- """
126+ if with_return :
127+ main_content = """\n
128+ import asyncio
129+ async def main():
130+ await asyncio.sleep(1)
131+ print('hello world')
132+ return 0
133+ """
134+ else :
135+ main_content = """\n
136+ import asyncio
137+ async def main():
138+ await asyncio.sleep(1)
139+ print('hello world')
140+ """
135141 write_main (to_mount_dir , main_content )
136142
137143 # fmt: off
You can’t perform that action at this time.
0 commit comments