Skip to content

Commit 95fe8c3

Browse files
committed
_internal(fix[async_subprocess]): Fix mypy type errors and formatting
why: Ensure Phase 1 passes full verification pipeline what: - Add None checks before .strip() calls on result.stdout in tests - Apply ruff formatting to list comprehension in _args_as_list()
1 parent 5808a77 commit 95fe8c3

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/libvcs/_internal/async_subprocess.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ def _args_as_list(self) -> list[str]:
141141
# Single command (str, bytes, or PathLike)
142142
return [str(args) if not isinstance(args, bytes) else args.decode()]
143143
# At this point, args is Sequence[StrOrBytesPath]
144-
return [str(arg) if not isinstance(arg, bytes) else arg.decode() for arg in args]
144+
return [
145+
str(arg) if not isinstance(arg, bytes) else arg.decode() for arg in args
146+
]
145147

146148
async def _create_process(
147149
self,

tests/_internal/test_async_subprocess.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ async def test_run_with_cwd(self, tmp_path: Path) -> None:
187187
cmd = AsyncSubprocessCommand(args=["pwd"], cwd=tmp_path)
188188
result = await cmd.run(text=True)
189189

190+
assert result.stdout is not None
190191
assert result.stdout.strip() == str(tmp_path)
191192

192193
@pytest.mark.asyncio
@@ -222,16 +223,12 @@ async def test_wait_with_timeout(self) -> None:
222223
@pytest.mark.asyncio
223224
async def test_concurrent_commands(self) -> None:
224225
"""Test running multiple commands concurrently."""
225-
commands = [
226-
AsyncSubprocessCommand(args=["echo", str(i)])
227-
for i in range(5)
228-
]
226+
commands = [AsyncSubprocessCommand(args=["echo", str(i)]) for i in range(5)]
229227

230-
results = await asyncio.gather(
231-
*[cmd.run(text=True) for cmd in commands]
232-
)
228+
results = await asyncio.gather(*[cmd.run(text=True) for cmd in commands])
233229

234230
assert len(results) == 5
235231
for i, result in enumerate(results):
232+
assert result.stdout is not None
236233
assert result.stdout.strip() == str(i)
237234
assert result.returncode == 0

0 commit comments

Comments
 (0)