From a090b320882935270b3abcd25350cc27d90b3a93 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 12:09:16 -0500 Subject: [PATCH 01/19] Revert "PYTHON-5342 - Skip async test_srv_polling tests on Windows (#2320)" This reverts commit e7db0e34aadeeccd320683fe33434100ef4c1540. --- test/asynchronous/test_srv_polling.py | 2 -- test/test_srv_polling.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index b40aa90cfa..3dcd21ef1d 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -20,7 +20,6 @@ import time from test.utils_shared import FunctionCallRecorder from typing import Any -from unittest import skipIf sys.path[0:0] = [""] @@ -92,7 +91,6 @@ def __exit__(self, exc_type, exc_val, exc_tb): self.disable() -@skipIf(not _IS_SYNC and sys.platform == "win32", "PYTHON-5342 known issue on Windows") class TestSrvPolling(AsyncPyMongoTestCase): BASE_SRV_RESPONSE = [ ("localhost.test.build.10gen.cc", 27017), diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index 0d84d41241..df802acb43 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -20,7 +20,6 @@ import time from test.utils_shared import FunctionCallRecorder from typing import Any -from unittest import skipIf sys.path[0:0] = [""] @@ -92,7 +91,6 @@ def __exit__(self, exc_type, exc_val, exc_tb): self.disable() -@skipIf(not _IS_SYNC and sys.platform == "win32", "PYTHON-5342 known issue on Windows") class TestSrvPolling(PyMongoTestCase): BASE_SRV_RESPONSE = [ ("localhost.test.build.10gen.cc", 27017), From 2e7914cc2fb2b26862d953fc768cccf3a1695264 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 12:10:43 -0500 Subject: [PATCH 02/19] windows-ctypes --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index bdc0d7edc7..1ef6105c57 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -dnspython>=1.16.0,<3.0.0 +git+https://github.com/blink1073/dnspython.git@windows-ctypes From 7c777bc621d0bc613258907aad60ccf20a7629b4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 12:18:40 -0500 Subject: [PATCH 03/19] fix requirements --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1ef6105c57..a7a91e345c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -git+https://github.com/blink1073/dnspython.git@windows-ctypes +dnspython @ git+https://github.com/blink1073/dnspython.git@windows-ctypes From 7e17df6c61c988e883c21ce71087cedbce8a360a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 12:23:50 -0500 Subject: [PATCH 04/19] fix metadata --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index fb2dd58131..ccfafa0a7d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,6 +77,9 @@ typing = [ path = "pymongo/_version.py" validate-bump = false +[tool.hatch.metadata] +allow-direct-references = true + [tool.hatch.build.targets.wheel] packages = ["bson","gridfs", "pymongo"] From 06b934727d87600d61d9dfee1c0a4127118c380f Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 15:13:03 -0500 Subject: [PATCH 05/19] fix the test --- test/asynchronous/test_srv_polling.py | 2 +- test/test_srv_polling.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index 3dcd21ef1d..2acf2dcb0c 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -177,7 +177,7 @@ def dns_resolver_response(): with SrvPollingKnobs(ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME): client = self.simple_client(self.CONNECTION_STRING) await client.aconnect() - await self.assert_nodelist_change(self.BASE_SRV_RESPONSE, client) + await assertion_method(self.BASE_SRV_RESPONSE, client) # Patch list of hosts returned by DNS query. with SrvPollingKnobs( nodelist_callback=dns_resolver_response, count_resolver_calls=count_resolver_calls diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index df802acb43..9e7855c072 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -177,7 +177,7 @@ def dns_resolver_response(): with SrvPollingKnobs(ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME): client = self.simple_client(self.CONNECTION_STRING) client._connect() - self.assert_nodelist_change(self.BASE_SRV_RESPONSE, client) + assertion_method(self.BASE_SRV_RESPONSE, client) # Patch list of hosts returned by DNS query. with SrvPollingKnobs( nodelist_callback=dns_resolver_response, count_resolver_calls=count_resolver_calls From f7ca050086e684e4a55050a48e8743ede55d834c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 16:00:46 -0500 Subject: [PATCH 06/19] debug --- test/asynchronous/test_srv_polling.py | 4 +++- test/test_srv_polling.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index 2acf2dcb0c..a279f2468e 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -177,7 +177,7 @@ def dns_resolver_response(): with SrvPollingKnobs(ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME): client = self.simple_client(self.CONNECTION_STRING) await client.aconnect() - await assertion_method(self.BASE_SRV_RESPONSE, client) + await self.assert_nodelist_change(self.BASE_SRV_RESPONSE, client) # Patch list of hosts returned by DNS query. with SrvPollingKnobs( nodelist_callback=dns_resolver_response, count_resolver_calls=count_resolver_calls @@ -219,6 +219,8 @@ async def test_dns_failures(self): def response_callback(*args): raise exc("DNS Failure!") + print(exc) + await self.run_scenario(response_callback, False) async def test_dns_record_lookup_empty(self): diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index 9e7855c072..ff2f5297b2 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -177,7 +177,7 @@ def dns_resolver_response(): with SrvPollingKnobs(ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME): client = self.simple_client(self.CONNECTION_STRING) client._connect() - assertion_method(self.BASE_SRV_RESPONSE, client) + self.assert_nodelist_change(self.BASE_SRV_RESPONSE, client) # Patch list of hosts returned by DNS query. with SrvPollingKnobs( nodelist_callback=dns_resolver_response, count_resolver_calls=count_resolver_calls @@ -219,6 +219,8 @@ def test_dns_failures(self): def response_callback(*args): raise exc("DNS Failure!") + print(exc) + self.run_scenario(response_callback, False) def test_dns_record_lookup_empty(self): From c93f0e3900aaab7db1b310ebdad1bfe99e617f31 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 16:23:07 -0500 Subject: [PATCH 07/19] debug --- test/asynchronous/test_srv_polling.py | 2 ++ test/test_srv_polling.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index a279f2468e..f7bedd57a1 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -53,6 +53,7 @@ def __init__( self.old_dns_resolver_response = None def enable(self): + print("enable") self.old_min_srv_rescan_interval = common.MIN_SRV_RESCAN_INTERVAL self.old_dns_resolver_response = ( pymongo.asynchronous.srv_resolver._SrvResolver.get_hosts_and_min_ttl @@ -82,6 +83,7 @@ def __enter__(self): self.enable() def disable(self): + print("disable") common.MIN_SRV_RESCAN_INTERVAL = self.old_min_srv_rescan_interval # type: ignore pymongo.asynchronous.srv_resolver._SrvResolver.get_hosts_and_min_ttl = ( # type: ignore self.old_dns_resolver_response diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index ff2f5297b2..2173696e18 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -53,6 +53,7 @@ def __init__( self.old_dns_resolver_response = None def enable(self): + print("enable") self.old_min_srv_rescan_interval = common.MIN_SRV_RESCAN_INTERVAL self.old_dns_resolver_response = ( pymongo.synchronous.srv_resolver._SrvResolver.get_hosts_and_min_ttl @@ -82,6 +83,7 @@ def __enter__(self): self.enable() def disable(self): + print("disable") common.MIN_SRV_RESCAN_INTERVAL = self.old_min_srv_rescan_interval # type: ignore pymongo.synchronous.srv_resolver._SrvResolver.get_hosts_and_min_ttl = ( # type: ignore self.old_dns_resolver_response From 5cb200d30b43a3f55857bf6c749b663f3e3d95b2 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 16:47:37 -0500 Subject: [PATCH 08/19] reorder --- test/asynchronous/test_srv_polling.py | 2 +- test/test_srv_polling.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index f7bedd57a1..d7e81dcacf 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -216,7 +216,7 @@ async def test_replace_both_with_two(self): async def test_dns_failures(self): from dns import exception - for exc in (exception.FormError, exception.TooBig, exception.Timeout): + for exc in (exception.FormError, exception.Timeout, exception.TooBig): def response_callback(*args): raise exc("DNS Failure!") diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index 2173696e18..e2b1205ba3 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -216,7 +216,7 @@ def test_replace_both_with_two(self): def test_dns_failures(self): from dns import exception - for exc in (exception.FormError, exception.TooBig, exception.Timeout): + for exc in (exception.FormError, exception.Timeout, exception.TooBig): def response_callback(*args): raise exc("DNS Failure!") From 19eebabd5d7f11ce3d06de107323530f4eb17fa8 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 17:35:56 -0500 Subject: [PATCH 09/19] add a delay --- test/asynchronous/test_srv_polling.py | 1 + test/test_srv_polling.py | 1 + 2 files changed, 2 insertions(+) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index d7e81dcacf..e2f30594f1 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -222,6 +222,7 @@ def response_callback(*args): raise exc("DNS Failure!") print(exc) + await asyncio.sleep(0.1) await self.run_scenario(response_callback, False) diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index e2b1205ba3..2f022b4996 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -222,6 +222,7 @@ def response_callback(*args): raise exc("DNS Failure!") print(exc) + time.sleep(0.1) self.run_scenario(response_callback, False) From 9cc74c7c75c2aaebba8de5639ba5cc11b90d1b81 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 17:48:25 -0500 Subject: [PATCH 10/19] try a longer delay --- test/asynchronous/test_srv_polling.py | 2 +- test/test_srv_polling.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index e2f30594f1..0e2cb4866e 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -222,7 +222,7 @@ def response_callback(*args): raise exc("DNS Failure!") print(exc) - await asyncio.sleep(0.1) + await asyncio.sleep(0.5) await self.run_scenario(response_callback, False) diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index 2f022b4996..acdd45df8a 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -222,7 +222,7 @@ def response_callback(*args): raise exc("DNS Failure!") print(exc) - time.sleep(0.1) + time.sleep(0.5) self.run_scenario(response_callback, False) From 3c5695f46e32042b0b06b6e6506a114c18a58fdf Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 19:26:39 -0500 Subject: [PATCH 11/19] try without exc --- test/asynchronous/test_srv_polling.py | 5 +++-- test/test_srv_polling.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index 0e2cb4866e..7dd459869f 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -219,10 +219,11 @@ async def test_dns_failures(self): for exc in (exception.FormError, exception.Timeout, exception.TooBig): def response_callback(*args): - raise exc("DNS Failure!") + # raise exc("DNS Failure!") + pass print(exc) - await asyncio.sleep(0.5) + # await asyncio.sleep(0.5) await self.run_scenario(response_callback, False) diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index acdd45df8a..b4d23722d1 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -219,10 +219,11 @@ def test_dns_failures(self): for exc in (exception.FormError, exception.Timeout, exception.TooBig): def response_callback(*args): - raise exc("DNS Failure!") + # raise exc("DNS Failure!") + pass print(exc) - time.sleep(0.5) + # time.sleep(0.5) self.run_scenario(response_callback, False) From d2d827c719c68a0b8a5cdea0149c43847305c0b8 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 19:38:33 -0500 Subject: [PATCH 12/19] remove callback call --- test/asynchronous/test_srv_polling.py | 4 ++-- test/test_srv_polling.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index 7dd459869f..007b71f4e0 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -65,8 +65,8 @@ def enable(self): async def mock_get_hosts_and_min_ttl(resolver, *args): assert self.old_dns_resolver_response is not None nodes, ttl = await self.old_dns_resolver_response(resolver) - if self.nodelist_callback is not None: - nodes = self.nodelist_callback() + # if self.nodelist_callback is not None: + # nodes = self.nodelist_callback() if self.ttl_time is not None: ttl = self.ttl_time return nodes, ttl diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index b4d23722d1..d6ea83cee9 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -65,8 +65,8 @@ def enable(self): def mock_get_hosts_and_min_ttl(resolver, *args): assert self.old_dns_resolver_response is not None nodes, ttl = self.old_dns_resolver_response(resolver) - if self.nodelist_callback is not None: - nodes = self.nodelist_callback() + # if self.nodelist_callback is not None: + # nodes = self.nodelist_callback() if self.ttl_time is not None: ttl = self.ttl_time return nodes, ttl From e8834fb397839a1a6344a5fa1783817e156704ab Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 19:50:00 -0500 Subject: [PATCH 13/19] try empty list --- test/asynchronous/test_srv_polling.py | 6 +++--- test/test_srv_polling.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index 007b71f4e0..0793272d93 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -65,8 +65,8 @@ def enable(self): async def mock_get_hosts_and_min_ttl(resolver, *args): assert self.old_dns_resolver_response is not None nodes, ttl = await self.old_dns_resolver_response(resolver) - # if self.nodelist_callback is not None: - # nodes = self.nodelist_callback() + if self.nodelist_callback is not None: + nodes = self.nodelist_callback() if self.ttl_time is not None: ttl = self.ttl_time return nodes, ttl @@ -220,7 +220,7 @@ async def test_dns_failures(self): def response_callback(*args): # raise exc("DNS Failure!") - pass + return [] print(exc) # await asyncio.sleep(0.5) diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index d6ea83cee9..170eb5f5a8 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -65,8 +65,8 @@ def enable(self): def mock_get_hosts_and_min_ttl(resolver, *args): assert self.old_dns_resolver_response is not None nodes, ttl = self.old_dns_resolver_response(resolver) - # if self.nodelist_callback is not None: - # nodes = self.nodelist_callback() + if self.nodelist_callback is not None: + nodes = self.nodelist_callback() if self.ttl_time is not None: ttl = self.ttl_time return nodes, ttl @@ -220,7 +220,7 @@ def test_dns_failures(self): def response_callback(*args): # raise exc("DNS Failure!") - pass + return [] print(exc) # time.sleep(0.5) From b929fd5696c712368c20cdbe4bd1d2fbc910e0b9 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 20:41:39 -0500 Subject: [PATCH 14/19] avoid cross-talk --- test/asynchronous/test_srv_polling.py | 11 ++++------- test/test_srv_polling.py | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index 0793272d93..ad683661f1 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -53,7 +53,6 @@ def __init__( self.old_dns_resolver_response = None def enable(self): - print("enable") self.old_min_srv_rescan_interval = common.MIN_SRV_RESCAN_INTERVAL self.old_dns_resolver_response = ( pymongo.asynchronous.srv_resolver._SrvResolver.get_hosts_and_min_ttl @@ -83,7 +82,6 @@ def __enter__(self): self.enable() def disable(self): - print("disable") common.MIN_SRV_RESCAN_INTERVAL = self.old_min_srv_rescan_interval # type: ignore pymongo.asynchronous.srv_resolver._SrvResolver.get_hosts_and_min_ttl = ( # type: ignore self.old_dns_resolver_response @@ -186,6 +184,9 @@ def dns_resolver_response(): ): await assertion_method(expected_response, client) + # Close the client early to avoid affecting the next scenario run. + client.close() + async def test_addition(self): response = self.BASE_SRV_RESPONSE[:] response.append(("localhost.test.build.10gen.cc", 27019)) @@ -219,11 +220,7 @@ async def test_dns_failures(self): for exc in (exception.FormError, exception.Timeout, exception.TooBig): def response_callback(*args): - # raise exc("DNS Failure!") - return [] - - print(exc) - # await asyncio.sleep(0.5) + raise exc("DNS Failure!") await self.run_scenario(response_callback, False) diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index 170eb5f5a8..db96cd57d3 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -53,7 +53,6 @@ def __init__( self.old_dns_resolver_response = None def enable(self): - print("enable") self.old_min_srv_rescan_interval = common.MIN_SRV_RESCAN_INTERVAL self.old_dns_resolver_response = ( pymongo.synchronous.srv_resolver._SrvResolver.get_hosts_and_min_ttl @@ -83,7 +82,6 @@ def __enter__(self): self.enable() def disable(self): - print("disable") common.MIN_SRV_RESCAN_INTERVAL = self.old_min_srv_rescan_interval # type: ignore pymongo.synchronous.srv_resolver._SrvResolver.get_hosts_and_min_ttl = ( # type: ignore self.old_dns_resolver_response @@ -186,6 +184,9 @@ def dns_resolver_response(): ): assertion_method(expected_response, client) + # Close the client early to avoid affecting the next scenario run. + client.close() + def test_addition(self): response = self.BASE_SRV_RESPONSE[:] response.append(("localhost.test.build.10gen.cc", 27019)) @@ -219,11 +220,7 @@ def test_dns_failures(self): for exc in (exception.FormError, exception.Timeout, exception.TooBig): def response_callback(*args): - # raise exc("DNS Failure!") - return [] - - print(exc) - # time.sleep(0.5) + raise exc("DNS Failure!") self.run_scenario(response_callback, False) From 94dae399181b2b81bf4e26f21f95fbc6b2d7cd55 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 7 May 2025 21:03:41 -0500 Subject: [PATCH 15/19] fix close --- test/asynchronous/test_srv_polling.py | 4 ++-- test/test_srv_polling.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index ad683661f1..fd79c06d61 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -184,8 +184,8 @@ def dns_resolver_response(): ): await assertion_method(expected_response, client) - # Close the client early to avoid affecting the next scenario run. - client.close() + # Close the client early to avoid affecting the next scenario run. + await client.close() async def test_addition(self): response = self.BASE_SRV_RESPONSE[:] diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index db96cd57d3..85fcc3b045 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -184,8 +184,8 @@ def dns_resolver_response(): ): assertion_method(expected_response, client) - # Close the client early to avoid affecting the next scenario run. - client.close() + # Close the client early to avoid affecting the next scenario run. + client.close() def test_addition(self): response = self.BASE_SRV_RESPONSE[:] From c3ea4652524bfe104eb5733adce4b82eebd1b5af Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 8 May 2025 06:08:04 -0500 Subject: [PATCH 16/19] try with source repo --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a7a91e345c..a1624cff41 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -dnspython @ git+https://github.com/blink1073/dnspython.git@windows-ctypes +dnspython # @ git+https://github.com/blink1073/dnspython.git@windows-ctypes From ef37568c035ff2dcdc4796b1027fa3d5d49448f6 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 8 May 2025 10:51:36 -0500 Subject: [PATCH 17/19] undo dnspython changes --- pyproject.toml | 3 --- requirements.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ccfafa0a7d..fb2dd58131 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,9 +77,6 @@ typing = [ path = "pymongo/_version.py" validate-bump = false -[tool.hatch.metadata] -allow-direct-references = true - [tool.hatch.build.targets.wheel] packages = ["bson","gridfs", "pymongo"] diff --git a/requirements.txt b/requirements.txt index a1624cff41..bdc0d7edc7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -dnspython # @ git+https://github.com/blink1073/dnspython.git@windows-ctypes +dnspython>=1.16.0,<3.0.0 From eccc85ae03c184ca603355ae48bb62e0b6801717 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 8 May 2025 10:53:34 -0500 Subject: [PATCH 18/19] undo ordering --- test/asynchronous/test_srv_polling.py | 5 ++++- test/test_srv_polling.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index fd79c06d61..488ba0bd0b 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -217,7 +217,7 @@ async def test_replace_both_with_two(self): async def test_dns_failures(self): from dns import exception - for exc in (exception.FormError, exception.Timeout, exception.TooBig): + for exc in (exception.FormError, exception.TooBig, exception.Timeout): def response_callback(*args): raise exc("DNS Failure!") @@ -254,6 +254,9 @@ def final_callback(): # Nodelist should reflect new valid DNS resolver response. await self.assert_nodelist_change(response_final, client) + # Close the client early to avoid affecting the next scenario run. + await client.close() + async def test_recover_from_initially_empty_seedlist(self): def empty_seedlist(): return [] diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index 85fcc3b045..9bd7ab0dc9 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -217,7 +217,7 @@ def test_replace_both_with_two(self): def test_dns_failures(self): from dns import exception - for exc in (exception.FormError, exception.Timeout, exception.TooBig): + for exc in (exception.FormError, exception.TooBig, exception.Timeout): def response_callback(*args): raise exc("DNS Failure!") @@ -254,6 +254,9 @@ def final_callback(): # Nodelist should reflect new valid DNS resolver response. self.assert_nodelist_change(response_final, client) + # Close the client early to avoid affecting the next scenario run. + client.close() + def test_recover_from_initially_empty_seedlist(self): def empty_seedlist(): return [] From 859b116c00c2046ec1cf96dc91a61d7045a1a8e7 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 8 May 2025 10:56:44 -0500 Subject: [PATCH 19/19] undo extra change --- test/asynchronous/test_srv_polling.py | 3 --- test/test_srv_polling.py | 3 --- 2 files changed, 6 deletions(-) diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index 488ba0bd0b..3ba50e77a8 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -254,9 +254,6 @@ def final_callback(): # Nodelist should reflect new valid DNS resolver response. await self.assert_nodelist_change(response_final, client) - # Close the client early to avoid affecting the next scenario run. - await client.close() - async def test_recover_from_initially_empty_seedlist(self): def empty_seedlist(): return [] diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index 9bd7ab0dc9..971c3bad50 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -254,9 +254,6 @@ def final_callback(): # Nodelist should reflect new valid DNS resolver response. self.assert_nodelist_change(response_final, client) - # Close the client early to avoid affecting the next scenario run. - client.close() - def test_recover_from_initially_empty_seedlist(self): def empty_seedlist(): return []