Skip to content

Commit 5914ea0

Browse files
authored
PYTHON-5342 Fix test_dns_failures test (#2336)
1 parent d0b0dc3 commit 5914ea0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/asynchronous/test_srv_polling.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import time
2121
from test.utils_shared import FunctionCallRecorder
2222
from typing import Any
23-
from unittest import skipIf
2423

2524
sys.path[0:0] = [""]
2625

@@ -92,7 +91,6 @@ def __exit__(self, exc_type, exc_val, exc_tb):
9291
self.disable()
9392

9493

95-
@skipIf(not _IS_SYNC and sys.platform == "win32", "PYTHON-5342 known issue on Windows")
9694
class TestSrvPolling(AsyncPyMongoTestCase):
9795
BASE_SRV_RESPONSE = [
9896
("localhost.test.build.10gen.cc", 27017),
@@ -186,6 +184,9 @@ def dns_resolver_response():
186184
):
187185
await assertion_method(expected_response, client)
188186

187+
# Close the client early to avoid affecting the next scenario run.
188+
await client.close()
189+
189190
async def test_addition(self):
190191
response = self.BASE_SRV_RESPONSE[:]
191192
response.append(("localhost.test.build.10gen.cc", 27019))

test/test_srv_polling.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import time
2121
from test.utils_shared import FunctionCallRecorder
2222
from typing import Any
23-
from unittest import skipIf
2423

2524
sys.path[0:0] = [""]
2625

@@ -92,7 +91,6 @@ def __exit__(self, exc_type, exc_val, exc_tb):
9291
self.disable()
9392

9493

95-
@skipIf(not _IS_SYNC and sys.platform == "win32", "PYTHON-5342 known issue on Windows")
9694
class TestSrvPolling(PyMongoTestCase):
9795
BASE_SRV_RESPONSE = [
9896
("localhost.test.build.10gen.cc", 27017),
@@ -186,6 +184,9 @@ def dns_resolver_response():
186184
):
187185
assertion_method(expected_response, client)
188186

187+
# Close the client early to avoid affecting the next scenario run.
188+
client.close()
189+
189190
def test_addition(self):
190191
response = self.BASE_SRV_RESPONSE[:]
191192
response.append(("localhost.test.build.10gen.cc", 27019))

0 commit comments

Comments
 (0)