From: Štěpán Balážik Date: Thu, 30 Oct 2025 13:53:44 +0000 (+0100) Subject: Remove dnspython<2.0.0 compatibility hacks from custom servers X-Git-Tag: v9.21.17~25^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c2a72143c66b8aa81e0b2c2425fcc106a86cb2c;p=thirdparty%2Fbind9.git Remove dnspython<2.0.0 compatibility hacks from custom servers isctest.asyncserver requires dnspython 2+ now. --- diff --git a/bin/tests/system/chain/ans3/ans.py b/bin/tests/system/chain/ans3/ans.py index 299f0423544..b61cd9d79a5 100755 --- a/bin/tests/system/chain/ans3/ans.py +++ b/bin/tests/system/chain/ans3/ans.py @@ -31,7 +31,7 @@ from isctest.asyncserver import ( try: dns_namerelation_equal = dns.name.NameRelation.EQUAL dns_namerelation_subdomain = dns.name.NameRelation.SUBDOMAIN -except AttributeError: # dnspython < 2.0.0 compat +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 diff --git a/bin/tests/system/chain/ans4/ans.py b/bin/tests/system/chain/ans4/ans.py index f175a88c1e0..2f0d8c3352e 100755 --- a/bin/tests/system/chain/ans4/ans.py +++ b/bin/tests/system/chain/ans4/ans.py @@ -34,11 +34,6 @@ from isctest.asyncserver import ( ResponseAction, ) -try: - RdataType = dns.rdatatype.RdataType -except AttributeError: # dnspython < 2.0.0 compat - RdataType = int # type: ignore - class ChainNameGenerator: """ @@ -105,13 +100,13 @@ class RecordGenerator(abc.ABC): @classmethod def create_rrset( - cls, owner: dns.name.Name, rrtype: RdataType, rdata: str + cls, owner: dns.name.Name, rrtype: dns.rdatatype.RdataType, rdata: str ) -> dns.rrset.RRset: return dns.rrset.from_text(owner, 86400, dns.rdataclass.IN, rrtype, rdata) @classmethod def create_rrset_signature( - cls, owner: dns.name.Name, rrtype: RdataType + cls, owner: dns.name.Name, rrtype: dns.rdatatype.RdataType ) -> dns.rrset.RRset: covers = dns.rdatatype.to_text(rrtype) ttl = "86400" diff --git a/bin/tests/system/isctest/asyncserver.py b/bin/tests/system/isctest/asyncserver.py index cd7d7027c7e..dfaf125709f 100644 --- a/bin/tests/system/isctest/asyncserver.py +++ b/bin/tests/system/isctest/asyncserver.py @@ -53,13 +53,6 @@ import dns.tsig import dns.version import dns.zone -try: - RdataType = dns.rdatatype.RdataType - RdataClass = dns.rdataclass.RdataClass -except AttributeError: # dnspython < 2.0.0 compat - RdataType = int # type: ignore - RdataClass = int # type: ignore - _UdpHandler = Callable[ [bytes, Tuple[str, int], asyncio.DatagramTransport], Coroutine[Any, Any, None] @@ -291,11 +284,11 @@ class QueryContext: return self.alias or self.qname @property - def qclass(self) -> RdataClass: + def qclass(self) -> dns.rdataclass.RdataClass: return self.query.question[0].rdclass @property - def qtype(self) -> RdataType: + def qtype(self) -> dns.rdatatype.RdataType: return self.query.question[0].rdtype diff --git a/bin/tests/system/qmin/qmin_ans.py b/bin/tests/system/qmin/qmin_ans.py index b78e723ecba..6185e15a109 100644 --- a/bin/tests/system/qmin/qmin_ans.py +++ b/bin/tests/system/qmin/qmin_ans.py @@ -25,8 +25,6 @@ from isctest.asyncserver import ( ResponseAction, ) -from isctest.compat import dns_rcode - def log_query(qctx: QueryContext) -> None: """ @@ -66,7 +64,7 @@ class EntRcodeChanger(DomainHandler): @property @abc.abstractmethod - def rcode(self) -> dns_rcode: + def rcode(self) -> dns.rcode.Rcode: raise NotImplementedError async def get_responses(