Skip to content

Commit 11179d4

Browse files
gijzelaerrclaude
andcommitted
Add port release delays in test teardown to prevent race conditions
The tests were failing on CI due to ports remaining in TIME_WAIT state. Adding a 0.2 second delay after stopping servers/partners allows the OS to fully release the port before the next test starts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b89b062 commit 11179d4

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

tests/test_partner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import time
23

34
import pytest
45
import unittest as unittest
@@ -21,6 +22,7 @@ def setUp(self) -> None:
2122
def tearDown(self) -> None:
2223
self.partner.stop()
2324
self.partner.destroy()
25+
time.sleep(0.2) # Give OS time to release the port
2426

2527
def test_as_b_send(self) -> None:
2628
self.partner.as_b_send()

tests/test_server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from ctypes import c_char
22
import logging
3+
import time
34

45
import pytest
56
import unittest
@@ -21,6 +22,7 @@ def setUp(self) -> None:
2122
def tearDown(self) -> None:
2223
self.server.stop()
2324
self.server.destroy()
25+
time.sleep(0.2) # Give OS time to release the port
2426

2527
def test_register_area(self) -> None:
2628
db1_type = c_char * 1024

0 commit comments

Comments
 (0)