Skip to content

Test closing a POSIX transport while it connects - #155

Open
Happyfield7 wants to merge 1 commit into
puddly:devfrom
Happyfield7:test-close-during-connect
Open

Happyfield7 wants to merge 1 commit into
puddly:devfrom
Happyfield7:test-close-during-connect

Conversation

@Happyfield7

Copy link
Copy Markdown
Contributor

Problem

PosixSerialTransport._connect returns early when the transport is closed after the port is configured, so connection_made is never called on a closed transport. No test covers this branch; CI reaches it only when test_async_linux_race_condition_connect_close happens to hit that timing (1 of 3 local runs). So codecov/project goes up or down by one line on unrelated PRs, as on #152.

Change

A test in tests/test_serial_posix.py closes the transport right after _reconfigure_port returns and checks that the protocol gets no connection_made or connection_lost. It runs on a pty with the platform's transport class.

Testing

The branch was covered in every run on macOS and Debian sid, and the test fails when the is_closing() check is removed. Full suite passes on both.

@Happyfield7
Happyfield7 force-pushed the test-close-during-connect branch from 6b235c5 to 094972e Compare November 20, 2026 22:44
@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.48%. Comparing base (c547768) to head (094972e).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #155      +/-   ##
==========================================
+ Coverage   94.39%   94.48%   +0.08%     
==========================================
  Files          25       25              
  Lines        4446     4446              
==========================================
+ Hits         4197     4201       +4     
+ Misses        249      245       -4     

☔ 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.

This branch has not been deployed

No deployments
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.

1 participant