]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove compatibility hacks for dnspython<2.7.0
authorNicki Křížek <nicki@isc.org>
Tue, 30 Dec 2025 13:29:51 +0000 (14:29 +0100)
committerNicki Křížek <nicki@isc.org>
Wed, 21 Jan 2026 15:07:31 +0000 (16:07 +0100)
The minimum required dnspython version is now 2.7.0 and those
compatibility hacks can be dropped.

72 files changed:
bin/tests/system/bailiwick/tests_bailiwick.py
bin/tests/system/chain/ans3/ans.py
bin/tests/system/chain/tests_sh_chain.py
bin/tests/system/checkds/tests_checkds.py
bin/tests/system/cipher-suites/tests_cipher_suites.py
bin/tests/system/cookie/tests_sh_cookie.py
bin/tests/system/digdelv/tests_sh_digdelv.py
bin/tests/system/dispatch/tests_connreset.py
bin/tests/system/dnssec-malformed-dnskey/tests_malformed_dnskey.py
bin/tests/system/dnssec/tests_badkey.py
bin/tests/system/dnssec/tests_badkey_broken.py
bin/tests/system/dnssec/tests_badkey_revoked.py
bin/tests/system/dnssec/tests_delv.py
bin/tests/system/dnssec/tests_policy.py
bin/tests/system/dnssec/tests_signing.py
bin/tests/system/dnssec/tests_tat.py
bin/tests/system/dnssec/tests_validation.py
bin/tests/system/dnssec/tests_validation_accept_expired.py
bin/tests/system/dnssec/tests_validation_managed_keys.py
bin/tests/system/dnssec/tests_validation_many_anchors.py
bin/tests/system/dnssec/tests_validation_multiview.py
bin/tests/system/dnstap/tests_dnstap.py
bin/tests/system/doth/tests_gnutls.py
bin/tests/system/ede24/common.py
bin/tests/system/fetchlimit/tests_sh_fetchlimit.py
bin/tests/system/forward/tests_sh_forward.py
bin/tests/system/glue/tests_glue.py
bin/tests/system/hooks/tests_hooks.py
bin/tests/system/isctest/asyncserver.py
bin/tests/system/isctest/check.py
bin/tests/system/isctest/compat.py [deleted file]
bin/tests/system/isctest/hypothesis/strategies.py
bin/tests/system/isctest/instance.py
bin/tests/system/isctest/kasp.py
bin/tests/system/isctest/name.py
bin/tests/system/isctest/query.py
bin/tests/system/ixfr/tests_sh_ixfr.py
bin/tests/system/kasp/tests_kasp.py
bin/tests/system/limits/tests_limits.py
bin/tests/system/migrate2kasp/tests_migrate2kasp.py
bin/tests/system/multisigner/tests_multisigner.py
bin/tests/system/names/tests_names.py
bin/tests/system/nsec3-answer/tests_nsec3.py
bin/tests/system/nsec3/tests_nsec3_change.py
bin/tests/system/nsec3/tests_nsec3_initial.py
bin/tests/system/nsec3/tests_nsec3_reconfig.py
bin/tests/system/nsec3/tests_nsec3_reload.py
bin/tests/system/nsec3/tests_nsec3_restart.py
bin/tests/system/nsec3/tests_nsec3_retransfer.py
bin/tests/system/nsupdate/tests_sh_nsupdate.py
bin/tests/system/optout/tests_optout.py
bin/tests/system/qmin/tests_sh_qmin.py
bin/tests/system/rollover-multisigner/tests_rollover_multisigner.py
bin/tests/system/rpzextra/tests_rpzextra.py
bin/tests/system/rpzrecurse/tests_sh_rpzrecurse.py
bin/tests/system/selftest/tests_zone_analyzer.py
bin/tests/system/sfcache/tests_sfcache.py
bin/tests/system/shutdown/tests_shutdown.py
bin/tests/system/statistics/tests_sh_statistics.py
bin/tests/system/statschannel/tests_json.py
bin/tests/system/statschannel/tests_xml.py
bin/tests/system/tcp/tests_tcp.py
bin/tests/system/timeouts/tests_tcp_timeouts.py
bin/tests/system/tools/tests_tools_nsec3hash.py
bin/tests/system/tsig/tests_badtime.py
bin/tests/system/tsig/tests_sh_tsig.py
bin/tests/system/tsig/tests_tsig_hypothesis.py
bin/tests/system/tsiggss/tests_isc_spnego_flaws.py
bin/tests/system/upforwd/tests_sh_upforwd.py
bin/tests/system/wildcard/tests_wildcard.py
bin/tests/system/xfer/tests_sh_xfer.py
bin/tests/system/zero/tests_sh_zero.py

index 7245c71bce2b0bf140c9c36acbefba3580687ff6..bd844bd71a3a3648b4c95f2baa4281a8944caef1 100644 (file)
@@ -17,9 +17,6 @@ import dns.message
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 import isctest
 from isctest.instance import NamedInstance
 
index 2b0c41ccb73aad7c2bae3e7627998fb6fe0e75d3..f10387fbf4459f0aa7690173a03f54e610065190 100755 (executable)
@@ -28,13 +28,6 @@ from isctest.asyncserver import (
     ResponseAction,
 )
 
-try:
-    dns_namerelation_equal = dns.name.NameRelation.EQUAL
-    dns_namerelation_subdomain = dns.name.NameRelation.SUBDOMAIN
-except AttributeError:  # dnspython < 2.3.0 compat
-    dns_namerelation_equal = dns.name.NAMERELN_EQUAL  # type: ignore
-    dns_namerelation_subdomain = dns.name.NAMERELN_SUBDOMAIN  # type: ignore
-
 
 def get_dname_rrset_at_name(
     zone: dns.zone.Zone, name: dns.name.Name
@@ -94,11 +87,11 @@ class Cve202125215(DomainHandler):
 
         relation, _, _ = qctx.qname.fullcompare(self_example_dname)
 
-        if relation in (dns_namerelation_equal, dns_namerelation_subdomain):
+        if relation in (dns.name.NameRelation.EQUAL, dns.name.NameRelation.SUBDOMAIN):
             del qctx.response.authority[:]
             qctx.response.set_rcode(dns.rcode.NOERROR)
 
-        if relation == dns_namerelation_subdomain:
+        if relation == dns.name.NameRelation.SUBDOMAIN:
             qctx.response.answer.append(dname_rrset)
             cname_rrset = dns.rrset.from_text(
                 qctx.qname,
index 5aa86d9082f47cbb07598743d268d21db18078c2..f7d7ac3b0158d4ed6e5b884b46924c1265f2267b 100644 (file)
@@ -11,9 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
index 8be24a830bc4fd29d68653dd5848c1b13dc8a6e8..9cf46a3843dccd6de304c60b228d0b6a5d3673ff 100755 (executable)
@@ -21,7 +21,6 @@ import time
 import isctest
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import dns.exception
 import dns.message
 import dns.name
index 86adc29da11257b0aab19fce6e580482455e6de3..782a24509f9b0a5843e695a2a92797ec064c9dbd 100644 (file)
@@ -13,8 +13,6 @@ from re import compile as Re
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.5.0")
-
 import dns.message
 
 import isctest
index d5f88dedebdf552586b050a6fdfdd6f9df70f02b..1c9e8280f5db7de302ce642d0e6a439e4871a41d 100644 (file)
@@ -11,9 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
index 3ed7811c1cb1cb6842623d4643feb46770ce4b03..2b3a72644b7509bfb78baf800bd5df9c7b777c88 100644 (file)
@@ -11,9 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "delv.out.*",
index 6c7f7140a60ea3c10d7b191787519f51d6bec7b2..01a1bbc5c09b704f886b359694b6f6c81edab76a 100644 (file)
@@ -14,9 +14,6 @@
 import pytest
 import isctest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 import dns.message
 
 pytestmark = pytest.mark.extra_artifacts(
index b83edf18739a5499c258f8dde7a82dbed2940144..d66644ce7b26494c933d557b37be92498e60399f 100644 (file)
@@ -16,9 +16,6 @@ import os
 import pytest
 
 pytest.importorskip("cryptography")
-pytest.importorskip(
-    "dns", minversion="2.7.0"
-)  # dns.dnssec.sign_zone(deterministic=...) needed
 
 from cryptography.hazmat.primitives.asymmetric import ec
 
index 6c318c9936cef1df36e59b0b113a388859f3d87c..ca80734d4d7c302bcce4e83506c2c6314ca2cf76 100644 (file)
@@ -16,9 +16,6 @@ import pytest
 import isctest
 from isctest.util import param
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index ae7050e02e6fec543b327eeb6fe88de5186eab81..1471ad0ca295378a0645d041e80ba843da8d0b7c 100644 (file)
@@ -9,14 +9,10 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-import pytest
 from dns import flags
 
 import isctest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 def bootstrap():
     return {
index 473c4479722419b18c53a05b27605bfe0d8da9d8..cb137b26ab1bc9b917f5f516cd708d37eccbd0c0 100644 (file)
 # information regarding copyright ownership.
 
 import isctest
-import pytest
-
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 
 def bootstrap():
index 5c24abb2cf2ec2f235d206523b990202a2bd92f7..436c869d8694fb73261c7d92de97773ec601dc5a 100644 (file)
@@ -17,9 +17,6 @@ import pytest
 
 import isctest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 51801d5d86cb9da7ad7b0399a3201deb4c1daef1..28612b3a4847bf5eb6b305cd7cced7f85fc09b05 100644 (file)
@@ -18,9 +18,6 @@ import pytest
 
 import isctest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 955f7f98ad4c0744782371bc7d9ff3553c29a07e..01ccff164c65fa314785010315d234aa271dad64 100644 (file)
@@ -20,7 +20,6 @@ from dns import dnssec, name, rdataclass, rdatatype, update
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 from isctest.kasp import SettimeOptions
 import isctest
 
index 543207a117de568e91448f882698c6252d01d65e..6fdfe36992a2aa51e0a4e4c75e286cf7d920d5bf 100644 (file)
@@ -18,9 +18,6 @@ import pytest
 
 import isctest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 2e8d94395a05a3dfca9c7f83c977534708a02cbd..9a74873392f62308c22067383ba6392564501c2c 100644 (file)
@@ -15,16 +15,14 @@ import shutil
 import time
 
 from dns import flags, name, rdataclass, rdatatype
+from dns.edns import EDECode
 
 import pytest
 
 import isctest
-from isctest.compat import EDECode
 import isctest.mark
 from isctest.util import param
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index d8f97f227b11e8c83264264d628fd0c0367cb9bf..409ecfe444a3d9cae38ba5ddaaaf3e16e8626f12 100644 (file)
@@ -13,11 +13,6 @@ from dns import flags
 
 import isctest
 
-import pytest
-
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 def bootstrap():
     return {
index 3cef4d67c96534106760e2e23affb13b3855cc31..082400b00019d3b71363f0dff59677aab0bfb6f6 100644 (file)
@@ -14,11 +14,6 @@ import shutil
 
 import isctest
 
-import pytest
-
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 def bootstrap():
     assert not os.path.exists("ns4/managed-keys.bind.jnl")
index a9865db2dce2037bc955e15afa34c35d1fa061c0..85be391e86567b4aa4458c067d60163bc95a7343 100644 (file)
 # information regarding copyright ownership.
 
 
+from dns.edns import EDECode
 import pytest
 
 import isctest
-from isctest.compat import EDECode
 from isctest.util import param
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 def bootstrap():
     return {
index e22f1d420b27cc0b6535c540542474042a0cfbdf..26a8fb450e8d56366f63f78d7dd9f84dead639de 100644 (file)
@@ -14,11 +14,6 @@ from re import compile as Re
 
 import isctest
 
-import pytest
-
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 def bootstrap():
     return {
index aec43785eaaab1f257170e715d3691deca9a3a46..67061ab9a5c5718d8770d5a4bf4548dce21a9c7c 100644 (file)
@@ -18,7 +18,6 @@ import isctest
 import isctest.mark
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import dns.rrset
 
 pytestmark = [
index 9c897714efe473f92bbbe7ca49fe89a8e613e184..42ef3f6973e61dff154c368fcaf501437e8858bb 100644 (file)
@@ -18,7 +18,7 @@ import time
 
 import pytest
 
-pytest.importorskip("dns")
+import dns
 import dns.exception
 import dns.name
 import dns.rdataclass
index 069ddd2ef5971cbd20ae61d2202a13c44bd9b24f..d7dd983e720aa0b342b101c0777ed3fbc11bdf71 100644 (file)
@@ -9,8 +9,9 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
+from dns.edns import EDECode
+
 import isctest
-from isctest.compat import EDECode
 
 
 def check_soa_noerror():
index 26bdff7fc24d7cceb0b9df74da06f271fc504e43..b996c60aa8e5a2ef9229cefff26fa434051593bc 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 458928b0bc81e0106ef63ccefe3103053bb630ce..0d30b8c3ad393f173441ab09e3db8aee3b75f61d 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 517781c7e22adb5c7bed2f9c7b9876c65e556f23..b015f56f236bdee7cbe69074d379885f27714c08 100644 (file)
@@ -16,7 +16,6 @@ import pytest
 
 import isctest
 
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 6c721c31dd877c8939fa39ea78f13ab6ad389350..e50720f218ee070ad309e27b77eabb5abbc6f644 100644 (file)
@@ -17,7 +17,6 @@ import dns
 import pytest
 import isctest
 
-pytest.importorskip("dns")
 
 pytestmark = pytest.mark.extra_artifacts(["conf/*.conf"])
 
index 85254800e9a6288b39aa8acd24015ec56aeb32b1..add1ab07ba4ddbece762d9805f461af14429101e 100644 (file)
@@ -114,7 +114,6 @@ class AsyncServer:
         tcp_handler: Optional[_TcpHandler],
         pidfile: Optional[str] = None,
     ) -> None:
-        self._abort_if_on_dnspython_version_less_than_2_0_0()
         logging.basicConfig(
             format="%(asctime)s %(levelname)8s  %(message)s",
             level=os.environ.get("ANS_LOG_LEVEL", "INFO").upper(),
@@ -142,14 +141,6 @@ class AsyncServer:
         self._pidfile: Optional[str] = pidfile
         self._work_done: Optional[asyncio.Future] = None
 
-    @classmethod
-    def _abort_if_on_dnspython_version_less_than_2_0_0(cls) -> None:
-        if dns.version.MAJOR < 2:
-            error = f"Using {cls.__name__} requires dnspython >= 2.0.0; "
-            error += 'add `pytest.importorskip("dns", minversion="2.0.0")` '
-            error += "to the test module to skip this test."
-            raise RuntimeError(error)
-
     def _get_ipv4_address_from_directory_name(self) -> str:
         containing_directory = pathlib.Path().absolute().stem
         match_result = re.match(r"ans(?P<index>\d+)", containing_directory)
index 7ca7779a3d3eedadc45706d33bdd0e095f2d2eb5..f7a1f12a849e056f1f716204f4c6c13da5e09ff6 100644 (file)
@@ -15,13 +15,13 @@ import os
 from typing import cast, List, Optional
 
 import dns.edns
+from dns.edns import EDECode, EDEOption
 import dns.flags
 import dns.message
 import dns.rcode
 import dns.zone
 
 import isctest.log
-from isctest.compat import dns_rcode, EDECode, EDEOption
 
 
 def rcode(message: dns.message.Message, expected_rcode) -> None:
@@ -29,19 +29,19 @@ def rcode(message: dns.message.Message, expected_rcode) -> None:
 
 
 def noerror(message: dns.message.Message) -> None:
-    rcode(message, dns_rcode.NOERROR)
+    rcode(message, dns.rcode.NOERROR)
 
 
 def notimp(message: dns.message.Message) -> None:
-    rcode(message, dns_rcode.NOTIMP)
+    rcode(message, dns.rcode.NOTIMP)
 
 
 def refused(message: dns.message.Message) -> None:
-    rcode(message, dns_rcode.REFUSED)
+    rcode(message, dns.rcode.REFUSED)
 
 
 def servfail(message: dns.message.Message) -> None:
-    rcode(message, dns_rcode.SERVFAIL)
+    rcode(message, dns.rcode.SERVFAIL)
 
 
 def adflag(message: dns.message.Message) -> None:
@@ -84,10 +84,6 @@ def _extract_ede_options(
 
 def noede(message: dns.message.Message) -> None:
     """Check that message contains no EDE option."""
-    if not hasattr(dns.edns, "EDECode"):
-        # dnspython<2.2.0 doesn't support EDE, skip check
-        return
-
     ede_options = _extract_ede_options(message)
     assert not ede_options, f"unexpected EDE options {ede_options} in {message}"
 
@@ -96,10 +92,6 @@ def ede(
     message: dns.message.Message, code: EDECode, text: Optional[str] = None
 ) -> None:
     """Check if message contains expected EDE code (and its text)."""
-    if not hasattr(dns.edns, "EDECode"):
-        # dnspython<2.2.0 doesn't support EDE, skip check
-        return
-
     msg_opts = _extract_ede_options(message)
     matching_opts = [opt for opt in msg_opts if opt.code == code]
 
@@ -206,7 +198,7 @@ def is_executable(cmd: str, errmsg: str) -> None:
 def named_alive(named_proc, resolver_ip):
     assert named_proc.poll() is None, "named isn't running"
     msg = isctest.query.create("version.bind", "TXT", "CH")
-    isctest.query.tcp(msg, resolver_ip, expected_rcode=dns_rcode.NOERROR)
+    isctest.query.tcp(msg, resolver_ip, expected_rcode=dns.rcode.NOERROR)
 
 
 def notauth(message: dns.message.Message) -> None:
diff --git a/bin/tests/system/isctest/compat.py b/bin/tests/system/isctest/compat.py
deleted file mode 100644 (file)
index ae6b157..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# SPDX-License-Identifier: MPL-2.0
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0.  If a copy of the MPL was not distributed with this
-# file, you can obtain one at https://mozilla.org/MPL/2.0/.
-#
-# See the COPYRIGHT file distributed with this work for additional
-# information regarding copyright ownership.
-
-from typing import Any, TYPE_CHECKING
-
-import dns.edns
-import dns.rcode
-
-# compatiblity with dnspython<2.0.0
-try:
-    # In dnspython>=2.0.0, dns.rcode.Rcode class is available
-    # pylint: disable=invalid-name
-    dns_rcode = dns.rcode.Rcode  # type: Any
-except AttributeError:
-    # In dnspython<2.0.0, selected rcodes are available as integers directly
-    # from dns.rcode
-    dns_rcode = dns.rcode
-
-
-if TYPE_CHECKING:
-    EDECode = dns.edns.EDECode
-    EDEOption = dns.edns.EDEOption
-else:
-    try:  # compatiblity with dnspython<2.2.0
-        EDECode = dns.edns.EDECode
-    except AttributeError:
-        # In dnspython<2.2.0, the dns.edns.EDECode doesn't exist.
-        #
-        # The primary use-case is for us to use existing EDECode objects from the
-        # class, e.g. EDECode.FILTERED. To mimick this behavior, use a string
-        # factory that just turns the attribute name into a string.
-        #
-        # The used compatibility hack doesn't really matter (as long as EDECode.xxx
-        # doesn't raise exception), as with dnspython versions prior to 2.2.0, any
-        # EDE checking will be skipped anyway.
-        class _CompatEDECode:
-            def __getattr__(self, name: str) -> str:
-                return name
-
-        EDECode = _CompatEDECode()
-    try:
-        EDEOption = dns.edns.EDEOption
-    except AttributeError:
-        # In dnspython<2.2.0, the dns.edns.EDEOption doesn't exist, so we stub it to be
-        # able to use it in type annotations.
-        class EDEOption:
-            def __new__(cls, *args, **kwargs):
-                raise RuntimeError("Using EDEOption requires dnspython>=2.2.0")
-
-
-# pylint: disable=unused-import
-try:
-    from dns.dnssec import DSDigest
-except ImportError:  # dnspython<2.0.0
-    import enum
-
-    class DSDigest(enum.IntEnum):  # type: ignore
-        """DNSSEC Delgation Signer Digest Algorithm"""
-
-        SHA1 = 1
-        SHA256 = 2
-        SHA384 = 4
index a3f9eac2b27c47f91ed92a5c72d94430f443a03f..e8badc6802b955ae0a17978248be7d630a6f944a 100644 (file)
@@ -143,13 +143,8 @@ def dns_names(
 
 
 RDATACLASS_MAX = RDATATYPE_MAX = 65535
-try:
-    dns_rdataclasses = builds(dns.rdataclass.RdataClass, integers(0, RDATACLASS_MAX))
-    dns_rdatatypes = builds(dns.rdatatype.RdataType, integers(0, RDATATYPE_MAX))
-except AttributeError:
-    # In old dnspython versions, RDataTypes and RDataClasses are int and not enums.
-    dns_rdataclasses = integers(0, RDATACLASS_MAX)  # type: ignore
-    dns_rdatatypes = integers(0, RDATATYPE_MAX)  # type: ignore
+dns_rdataclasses = builds(dns.rdataclass.RdataClass, integers(0, RDATACLASS_MAX))
+dns_rdatatypes = builds(dns.rdatatype.RdataType, integers(0, RDATATYPE_MAX))
 dns_rdataclasses_without_meta = dns_rdataclasses.filter(dns.rdataclass.is_metaclass)
 
 # NOTE: This should really be `dns_rdatatypes_without_meta = dns_rdatatypes_without_meta.filter(dns.rdatatype.is_metatype()`,
index 83bd51ffa5faa0fb742850d526b9189e44db536d..5e4d77517ad34da1002dee8f06905edb6519daee 100644 (file)
@@ -17,7 +17,7 @@ import os
 from pathlib import Path
 import re
 
-import dns.message
+import dns.update
 import dns.rcode
 
 from .log import debug, WatchLogFromStart, WatchLogFromHere
@@ -116,14 +116,11 @@ class NamedInstance:
         return self._rndc(command, timeout=timeout, **kwargs)
 
     def nsupdate(
-        self, update_msg: dns.message.Message, expected_rcode=dns.rcode.NOERROR
+        self, update_msg: dns.update.UpdateMessage, expected_rcode=dns.rcode.NOERROR
     ):
         """
         Issue a dynamic update to a server's zone.
         """
-        # FUTURE update_msg is actually dns.update.UpdateMessage, but it not
-        # typed properly here in order to support use of this module with
-        # dnspython<2.0.0
         zone = str(update_msg.zone[0].name)  # type: ignore[attr-defined]
         try:
             response = udp(
index 9b7189203073b16749112b5bd7b39d764093f6bd..255a5832ccd11f8bd0e6563a99875ef479e587b0 100644 (file)
@@ -26,12 +26,9 @@ import dns.rdatatype
 import dns.rrset
 import dns.tsig
 
-import pytest
-
 import isctest.log
 import isctest.query
 import isctest.util
-from isctest.compat import DSDigest
 from isctest.instance import NamedInstance
 from isctest.template import TrustAnchor
 from isctest.run import EnvCmd
@@ -511,7 +508,6 @@ class Key:
 
     @property
     def dnskey(self) -> dns.rrset.RRset:
-        pytest.importorskip("dns", minversion="2.2.0")  # dns.zonefile.read_rrsets
         with open(self.keyfile, "r", encoding="utf-8") as file:
             rrsets = dns.zonefile.read_rrsets(
                 file.read(),
@@ -526,7 +522,7 @@ class Key:
         ), f"DNSKEY not found in {self.keyfile}"
         return dnskey_rr
 
-    def into_ta(self, ta_type: str, dsdigest=DSDigest.SHA256) -> TrustAnchor:
+    def into_ta(self, ta_type: str, dsdigest=dns.dnssec.DSDigest.SHA256) -> TrustAnchor:
         dnskey = self.dnskey
         if ta_type in ["static-ds", "initial-ds"]:
             ds = dns.dnssec.make_ds(dnskey.name, dnskey[0], dsdigest)
index a2fe3ac42424472e3db6c4b0bf84886c882fe9ed..cc836f85db5e91065c79b42129b8df410d6f4549 100644 (file)
@@ -59,7 +59,6 @@ class ZoneAnalyzer:
         return cls(zonedb)
 
     def __init__(self, zone: dns.zone.Zone):
-        self._abort_on_old_dnspython()
         self.zone = zone
         assert self.zone.origin  # mypy hack
         # based on individual nodes but not relationship between nodes
@@ -85,14 +84,6 @@ class ZoneAnalyzer:
             .union(self.reachable_dnames)
         )
 
-    def _abort_on_old_dnspython(self):
-        if not hasattr(dns.name, "NameRelation"):
-            raise RuntimeError(
-                "ZoneAnalyzer requires dnspython>=2.3.0 for dns.name.NameRelation support. "
-                "Use pytest.importorskip('dns', minversion='2.3.0') to the test module to "
-                "skip this test."
-            )
-
     def get_names_with_type(self, rdtype) -> FrozenSet[Name]:
         return frozenset(
             name for name in self.zone if self.zone.get_rdataset(name, rdtype)
index e18b2001de115457de1f51aab6f53a25b27d8568..daa8ade0142f391d1c5aab7b6bc95ae0315cb761 100644 (file)
@@ -17,7 +17,6 @@ import dns.query
 import dns.message
 
 import isctest.log
-from isctest.compat import dns_rcode
 
 QUERY_TIMEOUT = 10
 
@@ -30,7 +29,7 @@ def generic_query(
     source: Optional[str] = None,
     timeout: int = QUERY_TIMEOUT,
     attempts: int = 10,
-    expected_rcode: dns_rcode = None,
+    expected_rcode: Optional[dns.rcode.Rcode] = None,
     verify: bool = False,
     log_query: bool = True,
     log_response: bool = True,
@@ -77,9 +76,9 @@ def generic_query(
         time.sleep(1)
 
     if expected_rcode is not None:
-        last_rcode = dns_rcode.to_text(res.rcode()) if res else None
+        last_rcode = dns.rcode.to_text(res.rcode()) if res else None
         isctest.log.debug(
-            f"isc.query.{query_func.__name__}(): expected rcode={dns_rcode.to_text(expected_rcode)}, last rcode={last_rcode}"
+            f"isc.query.{query_func.__name__}(): expected rcode={dns.rcode.to_text(expected_rcode)}, last rcode={last_rcode}"
         )
     raise dns.exception.Timeout
 
index a8b8143bfc7821403c4997fb65d66de531c8a960..171a0c6d2dbd7224eeb226aaf4cc7dfe7c07e4ca 100644 (file)
@@ -11,9 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out*",
index 018b975d5b2506cfdc310333b94ac3cb5bf8fa15..f5a02152dcae3e2d0b0051a2af8eb7e59d5e8c03 100644 (file)
@@ -20,7 +20,6 @@ import dns
 import dns.update
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import isctest
 import isctest.mark
 from isctest.kasp import (
index ca7214a9de4f64b1a2f2d5caeb38d2ebd5db2596..6949838ec74fc5f1f185c7808a889765c5337571 100644 (file)
@@ -14,9 +14,6 @@ import itertools
 import isctest
 import pytest
 
-# Everything from getting a big answer to creating an RR set with thousands
-# of records takes minutes of CPU and real time with dnspython < 2.0.0.
-pytest.importorskip("dns", minversion="2.0.0")
 import dns.rrset
 
 
index 426ef6d32a8aec2482a0124cb1eb21dd9b3b72d3..cb5f6e20516d433b19153e3e1363af326640f7d5 100644 (file)
 # information regarding copyright ownership.
 
 import os
-
 from datetime import timedelta
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import isctest
 import isctest.mark
 
index 15726f1eb14155a11e422c3d332c23e92f3368b3..a7587972ec5c6c78115323c91cb8834a6e76a2a5 100644 (file)
@@ -15,7 +15,6 @@ from re import compile as Re
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import dns
 import dns.update
 
index b72fcbec980fe1e1ac73791d40c825eab95a2039..38fc983d089705004153a153fdeb5fc980cc067b 100644 (file)
@@ -9,10 +9,6 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-import pytest
-
-pytest.importorskip("dns", minversion="2.7.0")
-
 import isctest
 
 
index 785f574f426d09341278a0a45a5a5c0915507557..c3ca0f645f72057c7fcc5ddf105511c783919c98 100755 (executable)
@@ -18,7 +18,6 @@ from typing import Container, Iterable, Optional, Set, Tuple
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.5.0")
 import dns.dnssec
 import dns.message
 import dns.name
index 4ebb2be2bc6646487226c1ba69606220f2525c00..6da20aaf7ff2624f9088a846e87a1f80cb5299e0 100644 (file)
@@ -15,10 +15,10 @@ import os
 import shutil
 import time
 
+import dns
 import dns.update
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import isctest
 import isctest.mark
 from isctest.vars.algorithms import RSASHA1
index b890bf9cbdcd8af8315103d1306f62ebf4bf35c3..9795cf04cb8f22002f79c2f3e141edfb73a9046b 100644 (file)
 
 import os
 
+import dns
 import dns.update
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import isctest
 import isctest.mark
 from isctest.vars.algorithms import RSASHA1
index c1edd67fc73df0cd1f9625950209f58f495f876c..dd29443050b81ed15e3d0d3f61b75a1ec58b5d99 100644 (file)
@@ -15,10 +15,10 @@ import os
 import shutil
 import time
 
+import dns
 import dns.update
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import isctest
 import isctest.mark
 from isctest.vars.algorithms import RSASHA1
index b3fb860288d6810bcfbf4ad3a6256cbddfc523b8..0e0daa884d109852997a7b4ca09c6091a55e7630 100644 (file)
@@ -15,9 +15,9 @@ import os
 import shutil
 import time
 
+import dns
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import isctest
 from nsec3.common import (
     ALGORITHM,
index e1e76c4f98a2f53e7c5ebbbc62247eca0d64e501..3505e8a562929a120b40fcff348cf89d292cabcd 100644 (file)
 
 import os
 
+import dns
 import dns.update
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import isctest
 import isctest.mark
 from nsec3.common import (
index 7ba4a44845d99a0a6a905ab771fc43c576d371e0..f9a3ca2e50986b16965f3638e3f206affe269256 100644 (file)
 
 # pylint: disable=redefined-outer-name,unused-import
 
+from datetime import timedelta
 import os
 import shutil
 
-from datetime import timedelta
-
+import dns
 import dns.update
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
 import isctest
 import isctest.mark
 from isctest.vars.algorithms import RSASHA256
index e91d9e5206fad202a5d432eeeafa18bfe6b4705e..2159a6a7dc92d2e30635bbbe01df5f5f237a7da1 100644 (file)
@@ -13,9 +13,6 @@ import platform
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "Kxxx*",
index 3f0df0bb5328387cdf0eee1b164fc3ca083b1da9..f004c1a89aaf8df7bffb4a2f05aff3e77e05531e 100755 (executable)
@@ -19,7 +19,7 @@ import sys
 import isctest
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
+import dns
 import dns.exception
 import dns.message
 import dns.name
index 4f5af7f56c1ec9de08681fea8aae18938e617fcd..0858b5cbf769e0cd319a33d038f2402945f029a6 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index b4cd6a6777858cab8584ee195a6f1f1da7eb6767..b463028bcb443a924bcd10df116eb8d13395dfb2 100644 (file)
@@ -16,7 +16,7 @@ import os
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
+import dns
 import dns.update
 
 import isctest
index aa910f9f7cda3836880217d54e81ebcb602ecdbf..948d747f4a48fd1528e9404c8bd8de0d1622b564 100644 (file)
@@ -15,12 +15,11 @@ import os
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
+import dns
 import dns.rcode
 import dns.rrset
 
 import isctest
-from isctest.compat import dns_rcode
 
 
 pytestmark = pytest.mark.extra_artifacts(
@@ -78,13 +77,13 @@ def test_rpz_multiple_views(qname, source, rcode):
         msg,
         ip="10.53.0.3",
         source="10.53.0.2",
-        expected_rcode=dns_rcode.NOERROR,
+        expected_rcode=dns.rcode.NOERROR,
     )
     isctest.query.tcp(
         msg,
         ip="10.53.0.3",
         source="10.53.0.5",
-        expected_rcode=dns_rcode.NOERROR,
+        expected_rcode=dns.rcode.NOERROR,
     )
 
     msg = isctest.query.create(qname, "A")
index 3798ed6ee671d8222d6e9ecc347a9eec68fd0134..27f95755b8a43c87dabc8d3373ec7b7cd13dadee 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 63798b5d676761588d954bdacbd0b1b2180c7c3f..35e014059b8a7b860d0466ad65bc2940bebd6a93 100755 (executable)
@@ -19,6 +19,7 @@ import collections
 import itertools
 from pathlib import Path
 
+import dns
 import dns.name
 from dns.name import Name
 import pytest
@@ -26,7 +27,6 @@ import pytest
 import isctest
 import isctest.name
 
-pytest.importorskip("dns", minversion="2.3.0")
 
 # set of properies present in the tested zone - read by tests_zone_analyzer.py
 CATEGORIES = frozenset(
index bed8b36da9d785322adc55f2089258be94784ec2..aa68805d74892ccf216a1f45af6dacb8cacbf253 100644 (file)
@@ -11,8 +11,9 @@
 
 import time
 
+from dns.edns import EDECode
+
 import isctest
-from isctest.compat import EDECode
 
 
 def check_sfcache_ede(ns, ede):
index 6f5ecd538e94952936b647408cc6cbc464aa36cb..2b5b9d522099fb512dcc067ced16a6416fe6e352 100755 (executable)
@@ -21,7 +21,7 @@ import time
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
+import dns
 import dns.exception
 
 import isctest
index e34dd437a85b53fdce261e80314921f78d4b8933..d7d87abb0a627b35260c3c91ac7067720f107376 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 6a2dbc9f9662e0b32f0587f1b4588af2d577c57a..f7ab476e1c0f03f9d0293018dc559a58b7232b30 100755 (executable)
 from datetime import datetime
 
 import pytest
+import requests
 
 import isctest.mark
 
 pytest.register_assert_rewrite("generic")
 import generic
 
-requests = pytest.importorskip("requests")
 
 pytestmark = [
     isctest.mark.with_json_c,
index 59fbcf0b06c12841f5b46127253b98ce766fc669..187f0fb97e7e5da4002569f6deadfd80d626f49f 100755 (executable)
@@ -15,13 +15,13 @@ from datetime import datetime
 import xml.etree.ElementTree as ET
 
 import pytest
+import requests
 
 import isctest.mark
 
 pytest.register_assert_rewrite("generic")
 import generic
 
-requests = pytest.importorskip("requests")
 
 pytestmark = [
     isctest.mark.with_libxml2,
index 02c7d093bee6c48433b910f3498e3708f68dbfe8..25ee0d0e1bf42abb51f03a79f400ecd6fc4e6d04 100644 (file)
@@ -19,7 +19,7 @@ import time
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
+import dns
 import dns.message
 import dns.query
 
index cb8defa71effd129710d958e52991af3a70f2560..e25bba5a042966ba180e2a037d978f773d44455e 100644 (file)
@@ -18,7 +18,7 @@ import time
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
+import dns
 import dns.edns
 import dns.message
 import dns.name
index 19571882c15e46919f2b11087e964995ed2aab1a..93670bc48cada6db2205060ab4a78d14d2285092 100644 (file)
@@ -19,7 +19,6 @@ from isctest.hypothesis.strategies import dns_names
 
 from hypothesis import strategies, given, settings
 
-pytest.importorskip("dns.dnssectypes")
 from dns.dnssectypes import NSEC3Hash
 import dns.dnssec
 
index 4f5a1b9f9741743f47eb296f5e76a4e1736b99a2..4c3a62c9d85f6d034bf726426cbb28d81fa9681c 100644 (file)
@@ -18,9 +18,6 @@ import time
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
-
 import dns.message
 import dns.query
 import dns.tsigkeyring
index 23dad0ada48931876bcd74e975f12b65e223a978..4c0a800bb590f3a601dce162a119c04dd69473bd 100644 (file)
@@ -21,9 +21,6 @@ pytestmark = pytest.mark.extra_artifacts(
     ]
 )
 
-# TSIG queries not supported by isctest.asyncserver with old dnspython
-pytest.importorskip("dns", minversion="2.0.0")
-
 
 def test_tsig(run_tests_sh):
     run_tests_sh()
index 06ff5452a022d30b2723c2ddb95b39480000c66c..791077ac35c5a82720a8a6e8bbdbe082c42099c2 100644 (file)
@@ -15,8 +15,6 @@ import time
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.7.0")  # TSIG parsing without validation
-
 import dns.exception
 import dns.message
 import dns.name
index 38b424d4c59bc1efa768938dc170b6e4ecbaef99..7e960ba6e1c26d51e2bdd99de05649d1a543987f 100755 (executable)
@@ -24,7 +24,7 @@ import pytest
 
 import isctest
 
-pytest.importorskip("dns")
+import dns
 import dns.message
 import dns.name
 import dns.rdata
index 28be6c4c2d7e8dab1e717b37e01678768d9f404c..3dfa290a3161ad43addc2d34dc4a63878cfa1511 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 459e3397b35ad8a5e7222fba00ae56d3a7dff15e..b086fc0d136ccd117553e563017244d27639cc5d 100755 (executable)
@@ -29,7 +29,7 @@ Limitations - untested properties:
 
 import pytest
 
-pytest.importorskip("dns", minversion="2.0.0")
+import dns
 import dns.message
 import dns.name
 import dns.query
index 5226cfc50b20181115064a173be8d6ead0836f2c..549fb241f5a90fe08ffe57497d92adb234046faf 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 50abfe0f2d635effd4529154d951ba3c262215c6..a80a0d6ee70dba5c5475d79ec68b185aa4847bdf 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-# isctest.asyncserver requires dnspython >= 2.0.0
-pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [