Skip to content

Commit 519120f

Browse files
Update src/_pytest/capture.py
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
1 parent b747390 commit 519120f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/_pytest/capture.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ def name(self) -> str:
177177
def mode(self) -> str:
178178
# TextIOWrapper doesn't expose a mode, but at least some of our
179179
# tests check it.
180-
return self.buffer.mode.replace("b", "") # type: ignore[no-any-return,attr-defined]
180+
assert hasattr(self.buffer, 'mode')
181+
return cast(str, self.buffer.mode.replace("b", ""))
181182

182183

183184
class CaptureIO(io.TextIOWrapper):

0 commit comments

Comments
 (0)