# information regarding copyright ownership.
import shutil
-from typing import Any, Optional
+from typing import Optional
import dns.rcode
import dns.message
import dns.zone
import isctest.log
-
-# 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
+from isctest.compat import dns_rcode
def rcode(message: dns.message.Message, expected_rcode) -> None:
--- /dev/null
+# 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
+
+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
import dns.message
import isctest.log
-
-# 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
+from isctest.compat import dns_rcode
QUERY_TIMEOUT = 10
import os
import subprocess
import time
-from typing import Any, Optional
+from typing import Optional
import isctest.log
+from isctest.compat import dns_rcode
import dns.message
-# 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
-
-
def cmd( # pylint: disable=too-many-arguments
args,
cwd=None,
pytest.importorskip("dns", minversion="2.0.0")
import isctest
+from isctest.compat import dns_rcode
import dns.message
-# 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
-
-
@pytest.mark.parametrize(
"qname,source,rcode",
[