diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index a2fde83c06..32dc4ec7f5 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -220,3 +220,55 @@ jobs: which python pip install -e ".[test]" PYMONGO_MUST_CONNECT=1 pytest -v -k client_context + + test_minimum: + permissions: + contents: read + runs-on: ubuntu-latest + name: Test using minimum dependencies and supported Python + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install uv + uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5 + with: + python-version: '3.9' + - name: Start MongoDB + uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0 + with: + mongodb-version: 6.0 + # Async and our test_dns do not support dnspython 1.X, so we don't run async or dns tests here + - name: Run tests + shell: bash + run: | + uv venv + source .venv/bin/activate + uv pip install -e ".[test]" --resolution=lowest-direct + pytest -v test/test_srv_polling.py + + test_minimum_for_async: + permissions: + contents: read + runs-on: ubuntu-latest + name: Test async's minimum dependencies and Python + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install uv + uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5 + with: + python-version: '3.9' + - name: Start MongoDB + uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0 + with: + mongodb-version: 6.0 + # The lifetime kwarg we use in srv resolution was added to the async resolver API in dnspython 2.1.0 + - name: Run tests + shell: bash + run: | + uv venv + source .venv/bin/activate + uv pip install -e ".[test]" --resolution=lowest-direct dnspython==2.1.0 --force-reinstall + pytest -v test/test_srv_polling.py test/test_dns.py test/asynchronous/test_srv_polling.py test/asynchronous/test_dns.py diff --git a/test/asynchronous/test_srv_polling.py b/test/asynchronous/test_srv_polling.py index 3ba50e77a8..2e248628da 100644 --- a/test/asynchronous/test_srv_polling.py +++ b/test/asynchronous/test_srv_polling.py @@ -363,7 +363,7 @@ def test_import_dns_resolver(self): # Regression test for PYTHON-4407 import dns.resolver - self.assertTrue(hasattr(dns.resolver, "resolve")) + self.assertTrue(hasattr(dns.resolver, "resolve") or hasattr(dns.resolver, "query")) if __name__ == "__main__": diff --git a/test/test_srv_polling.py b/test/test_srv_polling.py index 971c3bad50..16b076c1d3 100644 --- a/test/test_srv_polling.py +++ b/test/test_srv_polling.py @@ -363,7 +363,7 @@ def test_import_dns_resolver(self): # Regression test for PYTHON-4407 import dns.resolver - self.assertTrue(hasattr(dns.resolver, "resolve")) + self.assertTrue(hasattr(dns.resolver, "resolve") or hasattr(dns.resolver, "query")) if __name__ == "__main__":