Skip to content

Commit 947a37a

Browse files
committed
Refactor test to use parameterized arguments.
Updated the Windows-specific test to use `@pytest.mark.parametrize` for varied command arguments. This change improves test coverage and simplifies the testing of process creation scenarios. Signed-off-by: DanielAvdar <[email protected]>
1 parent 8ba9b5e commit 947a37a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/issues/test_552_windows_hang.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@
99

1010
@pytest.mark.skipif(sys.platform != "win32", reason="Windows-specific test")
1111
@pytest.mark.skipif(sys.version_info < (3, 11), reason="asyncio.timeout in 3.11+")
12+
@pytest.mark.parametrize(
13+
"args",
14+
[
15+
["/C", "echo", '{"jsonrpc": "2.0", "id": 1, "result": null}'],
16+
["dfghfgh"],
17+
["/C", "echo"],
18+
],
19+
)
1220
@pytest.mark.anyio
13-
async def test_windows_process_creation():
21+
async def test_windows_process_creation(args):
1422
"""
1523
Test that directly tests the process creation function that was fixed in issue #552.
1624
This simpler test verifies that Windows process creation works without hanging.
@@ -19,11 +27,7 @@ async def test_windows_process_creation():
1927
params = StdioServerParameters(
2028
command="cmd",
2129
# Echo a valid JSON-RPC response message that will be parsed correctly
22-
args=[
23-
"/c",
24-
"echo",
25-
'{"jsonrpc":"2.0","id":1,"result":{"status":"success"}}',
26-
],
30+
args=args,
2731
)
2832

2933
# Directly test the fixed function that was causing the hanging issue

0 commit comments

Comments
 (0)