Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add pragma no cover for platform-specific code
  • Loading branch information
FazeelUsmani committed May 1, 2026
commit de6ed6381bc4a7881b5fd3140d8fce2950a451bb
8 changes: 4 additions & 4 deletions src/_pytest/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,9 @@ def _tee_thread(self) -> None:
Uses non-blocking reads with select/poll for proper synchronization.
Responds to snap requests by draining the pipe and signaling completion.
"""
if sys.platform == "win32":
if sys.platform == "win32": # pragma: no cover
self._tee_thread_windows()
else:
else: # pragma: no cover
self._tee_thread_unix()

def _tee_thread_unix(self) -> None:
Expand Down Expand Up @@ -837,7 +837,7 @@ def _request_snap_sync(self) -> None:
self._snap_requested.set()

# Wait for thread to acknowledge (with timeout)
if not self._snap_complete.wait(timeout=1.0):
if not self._snap_complete.wait(timeout=1.0): # pragma: no cover
warnings.warn(
f"FDCaptureTee snap sync for fd {self.targetfd} timed out. "
"Some captured output may be incomplete.",
Expand Down Expand Up @@ -883,7 +883,7 @@ def done(self) -> None:
# Wait for thread to finish processing all data
if self._thread is not None:
self._thread.join(timeout=5.0)
if self._thread.is_alive():
if self._thread.is_alive(): # pragma: no cover
warnings.warn(
f"FDCaptureTee thread for fd {self.targetfd} did not exit cleanly "
"within timeout. Some captured output may be lost.",
Expand Down
Loading