Skip to content

Commit 94e5156

Browse files
author
Yoshihiro Takahara
committed
test: Add test cases for redirection error handling
- Add test for missing output redirection path - Add test for invalid redirection target - Fix code formatting
1 parent 2ca86f6 commit 94e5156

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22

3+
34
# Configure pytest-asyncio
45
def pytest_configure(config):
56
"""Configure pytest-asyncio defaults"""

tests/test_shell_executor_redirections.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,11 @@ async def test_invalid_redirection_paths():
122122
# Test missing path for input redirection
123123
with pytest.raises(ValueError, match="Missing path for input redirection"):
124124
executor._parse_command(["cat", "<"])
125+
126+
# Test missing path for output redirection
127+
with pytest.raises(ValueError, match="Missing path for output redirection"):
128+
executor._parse_command(["echo", "test", ">"])
129+
130+
# Test invalid redirection target: operator found for output
131+
with pytest.raises(ValueError, match="Invalid redirection target: operator found"):
132+
executor._parse_command(["echo", "test", ">", ">"])

0 commit comments

Comments
 (0)