Skip to content

Accept a split read in test_sync_read_timeout_with_partial_data - #157

Merged
puddly merged 1 commit into
puddly:devfrom
Happyfield7:fix-partial-read-test
Nov 20, 2026
Merged

puddly merged 1 commit into
puddly:devfrom
Happyfield7:fix-partial-read-test

Conversation

@Happyfield7

Copy link
Copy Markdown
Contributor

Problem

test_sync_read_timeout_with_partial_data checks that a read with a timeout returns available data at once instead of waiting for the timeout: it writes b"hello", calls read(5) with a 1.0 s timeout and expects the result within 0.2 s. It also assumes the five bytes arrive together, which a relay does not guarantee. read() returns what has arrived, so when the data comes in two pieces the test fails although the port behaves correctly. This happened on #155's Windows Python 3.13 job on the RFC 2217 pair: assert b'hell' == b'hello'.

Change

The test keeps its purpose: the first read(5) must return a non-empty prefix of b"hello" within 0.2 s. Any remaining bytes are then read with readexactly and the full payload is checked. No library change.

Testing

The test passes on all pairs on macOS and Debian sid (100 of 100 runs on Linux), and the full suite passes on both. A simulated split on a pty (hell, then o 50 ms later) passes the new assertions and fails the old one. The real split only happens on the Windows hub4com pair, which runs in CI only.

@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.37%. Comparing base (d6f291c) to head (7d842b5).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #157   +/-   ##
=======================================
  Coverage   94.37%   94.37%           
=======================================
  Files          25       25           
  Lines        4424     4426    +2     
=======================================
+ Hits         4175     4177    +2     
  Misses        249      249           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@puddly
puddly merged commit 84ef921 into puddly:dev Nov 20, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants