From 746ca1d481d040db8dda7203f3fa0c4248b8eca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Bal=C3=A1=C5=BEik?= Date: Sat, 21 Feb 2026 13:46:34 +0100 Subject: [PATCH] Automatically sort imports in Python code Generated with: ruff check --extend-select I --fix (with the changes to pyproject.toml applied). (cherry picked from commit ffd5b6ac262e8838dfc10790c6a67f545405a594) --- bin/tests/convert_trs_to_junit.py | 6 +++--- bin/tests/system/ans.py | 4 +--- bin/tests/system/bailiwick/ans1/ans.py | 6 +----- bin/tests/system/bailiwick/ans2/ans.py | 6 +----- bin/tests/system/bailiwick/tests_bailiwick.py | 4 ++-- bin/tests/system/checkds/tests_checkds.py | 6 +++--- .../cipher-suites/tests_cipher_suites.py | 3 +-- bin/tests/system/conftest.py | 10 ++++++---- bin/tests/system/convert_junit_to_trs.py | 5 +++-- bin/tests/system/cookie/cookie_ans.py | 5 ++--- bin/tests/system/digdelv/ans4/ans.py | 5 +---- bin/tests/system/digdelv/ans5/ans.py | 3 ++- bin/tests/system/digdelv/ans6/ans.py | 2 +- bin/tests/system/dispatch/tests_connreset.py | 6 +++--- .../tests_malformed_dnskey.py | 6 +++--- bin/tests/system/dnstap/tests_dnstap.py | 6 +++--- bin/tests/system/dnstap/ydump.py | 2 +- bin/tests/system/doth/conftest.py | 1 + bin/tests/system/doth/stress_http_quota.py | 12 +++++------ bin/tests/system/doth/tests_gnutls.py | 3 +-- bin/tests/system/ecdsa/tests_ecdsa.py | 2 +- bin/tests/system/filters/common.py | 3 ++- bin/tests/system/filters/tests_filter_a_v4.py | 4 ++-- bin/tests/system/filters/tests_filter_a_v6.py | 4 ++-- .../system/filters/tests_filter_aaaa_v4.py | 6 +++--- .../system/filters/tests_filter_aaaa_v6.py | 4 ++-- .../system/filters/tests_filter_checkconf.py | 4 ++-- .../system/filters/tests_filter_dns64.py | 4 ++-- bin/tests/system/isctest/__init__.py | 20 ++++++++++--------- bin/tests/system/isctest/asyncserver.py | 2 +- bin/tests/system/isctest/check.py | 6 ++++-- .../system/isctest/hypothesis/__init__.py | 3 +-- .../system/isctest/hypothesis/strategies.py | 5 +++-- bin/tests/system/isctest/instance.py | 8 ++++---- bin/tests/system/isctest/kasp.py | 14 +++++++------ bin/tests/system/isctest/log/__init__.py | 11 +++++----- bin/tests/system/isctest/log/basic.py | 5 +++-- bin/tests/system/isctest/log/watchlog.py | 2 +- bin/tests/system/isctest/mark.py | 5 +++-- bin/tests/system/isctest/name.py | 10 +++++----- bin/tests/system/isctest/query.py | 7 ++++--- bin/tests/system/isctest/run.py | 5 +++-- bin/tests/system/isctest/text.py | 5 +++-- bin/tests/system/isctest/vars/__init__.py | 4 ++-- bin/tests/system/isctest/vars/algorithms.py | 5 +++-- bin/tests/system/isctest/vars/all.py | 2 +- bin/tests/system/isctest/vars/basic.py | 1 - bin/tests/system/isctest/vars/dirs.py | 1 - bin/tests/system/isctest/vars/openssl.py | 3 ++- bin/tests/system/ixfr-nonminimal/ans2/ans.py | 4 ++-- bin/tests/system/ixfr-nonminimal/ans4/ans.py | 4 ++-- bin/tests/system/kasp/tests_kasp.py | 14 ++++++------- bin/tests/system/keepalive/tests_keepalive.py | 3 ++- .../system/keyfromlabel/tests_keyfromlabel.py | 3 ++- bin/tests/system/ksr/tests_ksr.py | 4 +++- bin/tests/system/limits/tests_limits.py | 4 ++-- .../system/migrate2kasp/tests_migrate2kasp.py | 3 ++- .../system/multisigner/tests_multisigner.py | 4 ++-- bin/tests/system/nsec3-answer/tests_nsec3.py | 11 +++++----- bin/tests/system/nsec3/common.py | 4 ++-- bin/tests/system/nsec3/tests_nsec3_change.py | 11 +++------- bin/tests/system/nsec3/tests_nsec3_initial.py | 11 +++------- .../system/nsec3/tests_nsec3_reconfig.py | 11 +++------- bin/tests/system/nsec3/tests_nsec3_reload.py | 7 ++----- bin/tests/system/nsec3/tests_nsec3_restart.py | 9 +++++---- .../system/nsec3/tests_nsec3_retransfer.py | 10 ++++------ bin/tests/system/nsupdate/ans4/ans.py | 6 +----- bin/tests/system/nzd2nzf/tests_nzd2nzf.py | 1 + bin/tests/system/optout/tests_optout.py | 6 +++--- bin/tests/system/re_compile_checker.py | 1 - bin/tests/system/resolver/ans2/ans.py | 4 ++-- bin/tests/system/resolver/ans3/ans.py | 2 +- bin/tests/system/resolver/ans8/ans.py | 6 +++--- bin/tests/system/rfc5011/tests_rfc5011.py | 1 + .../tests_rollover_algo_csk_initial.py | 17 ++++------------ .../tests_rollover_algo_csk_reconfig.py | 17 +++++++--------- .../tests_rollover_algo_ksk_zsk_initial.py | 17 ++++------------ .../tests_rollover_algo_ksk_zsk_reconfig.py | 17 +++++++--------- .../tests_rollover_csk_roll1.py | 16 ++++----------- .../tests_rollover_csk_roll2.py | 16 ++++----------- .../tests_rollover_dynamic2inline.py | 9 ++------- .../tests_rollover_enable_dnssec.py | 17 ++++------------ .../tests_rollover_going_insecure_initial.py | 16 +++------------ .../tests_rollover_going_insecure_reconfig.py | 15 ++++++-------- .../tests_rollover_three_is_a_crowd.py | 17 +++++++--------- .../tests_rollover_ksk_doubleksk.py | 19 ++++++++---------- .../tests_rollover_lifetime_initial.py | 12 +++-------- .../tests_rollover_lifetime_reconfig.py | 12 +++-------- .../tests_rollover_multisigner.py | 13 +++++------- .../tests_rollover_straight2none_initial.py | 16 +++------------ .../tests_rollover_straight2none_reconfig.py | 16 +++------------ .../tests_rollover_zsk_prepublication.py | 16 ++++----------- bin/tests/system/rollover/common.py | 1 + bin/tests/system/rollover/setup.py | 8 +++++--- .../system/rollover/tests_rollover_manual.py | 14 ++++++------- bin/tests/system/rpzextra/tests_rpzextra.py | 3 +-- .../system/selftest/tests_zone_analyzer.py | 6 ++++-- bin/tests/system/shutdown/tests_shutdown.py | 6 +++--- bin/tests/system/sortlist/tests_sortlist.py | 1 - bin/tests/system/statschannel/generic.py | 3 ++- bin/tests/system/statschannel/tests_xml.py | 1 + bin/tests/system/tcp/tests_tcp.py | 3 +-- .../system/timeouts/tests_tcp_timeouts.py | 3 +-- .../system/tools/tests_tools_nsec3hash.py | 10 +++++----- bin/tests/system/tsig/tests_badtime.py | 3 +-- .../system/tsig/tests_tsig_hypothesis.py | 8 ++++---- .../system/tsiggss/tests_isc_spnego_flaws.py | 7 +++---- bin/tests/system/verify/tests_verify.py | 3 ++- bin/tests/system/wildcard/tests_wildcard.py | 4 ++-- bin/tests/system/xfer/ans10/ans.py | 5 +---- bin/tests/system/xfer/ans9/ans.py | 2 +- bin/tests/system/xfer/tests_xfer.py | 7 ++++--- bin/tests/system/xferquota/tests_xferquota.py | 3 ++- bin/tests/system/zero/ans5/ans.py | 3 ++- doc/arm/_ext/iscconf.py | 3 +-- doc/arm/_ext/mergegrammar.py | 3 ++- doc/misc/checkgrammar.py | 1 + pyproject.toml | 11 ++++++++++ 118 files changed, 338 insertions(+), 462 deletions(-) diff --git a/bin/tests/convert_trs_to_junit.py b/bin/tests/convert_trs_to_junit.py index 73b1c576ee..32a360ec29 100755 --- a/bin/tests/convert_trs_to_junit.py +++ b/bin/tests/convert_trs_to_junit.py @@ -6,12 +6,12 @@ # # Convert automake .trs files into JUnit format suitable for Gitlab +from xml.etree import ElementTree +from xml.etree.ElementTree import Element, SubElement + import argparse import os import sys -from xml.etree import ElementTree -from xml.etree.ElementTree import Element -from xml.etree.ElementTree import SubElement # getting explicit encoding specification right for Python 2/3 would be messy, diff --git a/bin/tests/system/ans.py b/bin/tests/system/ans.py index 6ac5498d1d..3b822720a5 100644 --- a/bin/tests/system/ans.py +++ b/bin/tests/system/ans.py @@ -32,9 +32,7 @@ useful in other system tests, please consider opening a merge request extending isctest/asyncserver.py. """ -from isctest.asyncserver import ( - AsyncDnsServer, -) +from isctest.asyncserver import AsyncDnsServer def main() -> None: diff --git a/bin/tests/system/bailiwick/ans1/ans.py b/bin/tests/system/bailiwick/ans1/ans.py index 117a014e93..7606236fda 100644 --- a/bin/tests/system/bailiwick/ans1/ans.py +++ b/bin/tests/system/bailiwick/ans1/ans.py @@ -16,11 +16,7 @@ from typing import AsyncGenerator import dns.rdatatype import dns.rrset -from isctest.asyncserver import ( - DnsResponseSend, - QueryContext, - ResponseAction, -) +from isctest.asyncserver import DnsResponseSend, QueryContext, ResponseAction from ..bailiwick_ans import ResponseSpoofer, spoofing_server diff --git a/bin/tests/system/bailiwick/ans2/ans.py b/bin/tests/system/bailiwick/ans2/ans.py index 8dfa0749c8..1878167357 100644 --- a/bin/tests/system/bailiwick/ans2/ans.py +++ b/bin/tests/system/bailiwick/ans2/ans.py @@ -16,11 +16,7 @@ from typing import AsyncGenerator import dns.rdatatype import dns.rrset -from isctest.asyncserver import ( - DnsResponseSend, - QueryContext, - ResponseAction, -) +from isctest.asyncserver import DnsResponseSend, QueryContext, ResponseAction from ..bailiwick_ans import ResponseSpoofer, spoofing_server diff --git a/bin/tests/system/bailiwick/tests_bailiwick.py b/bin/tests/system/bailiwick/tests_bailiwick.py index bd844bd71a..105fc6de5a 100644 --- a/bin/tests/system/bailiwick/tests_bailiwick.py +++ b/bin/tests/system/bailiwick/tests_bailiwick.py @@ -14,12 +14,12 @@ from typing import Dict import time import dns.message - import pytest -import isctest from isctest.instance import NamedInstance +import isctest + @pytest.fixture(autouse=True) def autouse_flush_resolver_cache(servers: Dict[str, NamedInstance]) -> None: diff --git a/bin/tests/system/checkds/tests_checkds.py b/bin/tests/system/checkds/tests_checkds.py index 26265ad612..037517ca23 100755 --- a/bin/tests/system/checkds/tests_checkds.py +++ b/bin/tests/system/checkds/tests_checkds.py @@ -18,15 +18,15 @@ import os import sys import time -import isctest -import pytest - import dns.exception import dns.message import dns.name import dns.rcode import dns.rdataclass import dns.rdatatype +import pytest + +import isctest pytestmark = [ pytest.mark.skipif( diff --git a/bin/tests/system/cipher-suites/tests_cipher_suites.py b/bin/tests/system/cipher-suites/tests_cipher_suites.py index 4b2ba07518..94d0f255b7 100644 --- a/bin/tests/system/cipher-suites/tests_cipher_suites.py +++ b/bin/tests/system/cipher-suites/tests_cipher_suites.py @@ -11,9 +11,8 @@ from re import compile as Re -import pytest - import dns.message +import pytest import isctest import isctest.mark diff --git a/bin/tests/system/conftest.py b/bin/tests/system/conftest.py index ce402ad6b4..d43c0da484 100644 --- a/bin/tests/system/conftest.py +++ b/bin/tests/system/conftest.py @@ -9,24 +9,26 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import filecmp -import os from pathlib import Path from re import compile as Re + +import filecmp +import os import shutil import subprocess +import sys import tempfile import time -import sys import pytest pytest.register_assert_rewrite("isctest") # pylint: disable=wrong-import-position -import isctest from isctest.vars.dirs import SYSTEM_TEST_DIR_GIT_PATH +import isctest + # pylint: enable=wrong-import-position # Silence warnings caused by passing a pytest fixture to another fixture. diff --git a/bin/tests/system/convert_junit_to_trs.py b/bin/tests/system/convert_junit_to_trs.py index 83cf630274..429eaf09fe 100755 --- a/bin/tests/system/convert_junit_to_trs.py +++ b/bin/tests/system/convert_junit_to_trs.py @@ -6,11 +6,12 @@ # # Convert JUnit pytest output to automake .trs files -import argparse from pathlib import Path -import sys from xml.etree import ElementTree +import argparse +import sys + def junit_to_trs(junit_xml): root = ElementTree.fromstring(junit_xml) diff --git a/bin/tests/system/cookie/cookie_ans.py b/bin/tests/system/cookie/cookie_ans.py index 72f0e0ab46..84d3f7011c 100644 --- a/bin/tests/system/cookie/cookie_ans.py +++ b/bin/tests/system/cookie/cookie_ans.py @@ -20,12 +20,11 @@ import dns.tsigkeyring from isctest.asyncserver import ( AsyncDnsServer, - ResponseHandler, - DnsResponseSend, DnsProtocol, + DnsResponseSend, QueryContext, + ResponseHandler, ) - from isctest.name import prepend_label from isctest.vars.algorithms import ALG_VARS diff --git a/bin/tests/system/digdelv/ans4/ans.py b/bin/tests/system/digdelv/ans4/ans.py index 6f5346ff86..d162070c76 100644 --- a/bin/tests/system/digdelv/ans4/ans.py +++ b/bin/tests/system/digdelv/ans4/ans.py @@ -9,10 +9,7 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -from isctest.asyncserver import ( - AsyncDnsServer, - IgnoreAllQueries, -) +from isctest.asyncserver import AsyncDnsServer, IgnoreAllQueries def main() -> None: diff --git a/bin/tests/system/digdelv/ans5/ans.py b/bin/tests/system/digdelv/ans5/ans.py index a53045305d..6039559449 100644 --- a/bin/tests/system/digdelv/ans5/ans.py +++ b/bin/tests/system/digdelv/ans5/ans.py @@ -9,9 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import logging from typing import AsyncGenerator, List, Optional +import logging + import dns.rcode import dns.rdatatype import dns.rrset diff --git a/bin/tests/system/digdelv/ans6/ans.py b/bin/tests/system/digdelv/ans6/ans.py index 77e7141590..e723d96c16 100644 --- a/bin/tests/system/digdelv/ans6/ans.py +++ b/bin/tests/system/digdelv/ans6/ans.py @@ -17,8 +17,8 @@ import dns.rcode from isctest.asyncserver import ( AsyncDnsServer, DnsResponseSend, - ResponseHandler, QueryContext, + ResponseHandler, ) diff --git a/bin/tests/system/dispatch/tests_connreset.py b/bin/tests/system/dispatch/tests_connreset.py index 01a1bbc5c0..e263580cad 100644 --- a/bin/tests/system/dispatch/tests_connreset.py +++ b/bin/tests/system/dispatch/tests_connreset.py @@ -11,10 +11,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import pytest -import isctest - import dns.message +import pytest + +import isctest pytestmark = pytest.mark.extra_artifacts( [ diff --git a/bin/tests/system/dnssec-malformed-dnskey/tests_malformed_dnskey.py b/bin/tests/system/dnssec-malformed-dnskey/tests_malformed_dnskey.py index 2e6c667d22..efb5839ddc 100644 --- a/bin/tests/system/dnssec-malformed-dnskey/tests_malformed_dnskey.py +++ b/bin/tests/system/dnssec-malformed-dnskey/tests_malformed_dnskey.py @@ -9,18 +9,18 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import base64 from re import compile as Re +import base64 import os -import pytest from cryptography.hazmat.primitives.asymmetric import ec +from dns.rdtypes.dnskeybase import Flag import dns import dns.dnssec import dns.zone -from dns.rdtypes.dnskeybase import Flag +import pytest import isctest diff --git a/bin/tests/system/dnstap/tests_dnstap.py b/bin/tests/system/dnstap/tests_dnstap.py index 67061ab9a5..9004c45e83 100644 --- a/bin/tests/system/dnstap/tests_dnstap.py +++ b/bin/tests/system/dnstap/tests_dnstap.py @@ -14,11 +14,11 @@ import os import re -import isctest -import isctest.mark +import dns.rrset import pytest -import dns.rrset +import isctest +import isctest.mark pytestmark = [ isctest.mark.with_dnstap, diff --git a/bin/tests/system/dnstap/ydump.py b/bin/tests/system/dnstap/ydump.py index ab7e3c9ada..77bca8be7f 100644 --- a/bin/tests/system/dnstap/ydump.py +++ b/bin/tests/system/dnstap/ydump.py @@ -17,8 +17,8 @@ except (ModuleNotFoundError, ImportError): print("No python yaml module, skipping") sys.exit(1) -import subprocess import pprint +import subprocess DNSTAP_READ = sys.argv[1] DATAFILE = sys.argv[2] diff --git a/bin/tests/system/doth/conftest.py b/bin/tests/system/doth/conftest.py index b95baeaab5..2c2104d2fd 100644 --- a/bin/tests/system/doth/conftest.py +++ b/bin/tests/system/doth/conftest.py @@ -14,6 +14,7 @@ import shutil import pytest + import isctest diff --git a/bin/tests/system/doth/stress_http_quota.py b/bin/tests/system/doth/stress_http_quota.py index 930f944adf..82730c25a5 100755 --- a/bin/tests/system/doth/stress_http_quota.py +++ b/bin/tests/system/doth/stress_http_quota.py @@ -11,18 +11,16 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +from functools import reduce +from resource import RLIMIT_NOFILE, getrlimit, setrlimit + import os -import sys +import random import socket import subprocess -import random +import sys import time -from functools import reduce -from resource import getrlimit -from resource import setrlimit -from resource import RLIMIT_NOFILE - MULTIDIG_INSTANCES = 10 CONNECT_TRIES = 5 diff --git a/bin/tests/system/doth/tests_gnutls.py b/bin/tests/system/doth/tests_gnutls.py index 70ddd261f6..16ecdb5073 100644 --- a/bin/tests/system/doth/tests_gnutls.py +++ b/bin/tests/system/doth/tests_gnutls.py @@ -16,13 +16,12 @@ import struct import subprocess import time -import pytest - import dns import dns.exception import dns.name import dns.rdataclass import dns.rdatatype +import pytest import isctest diff --git a/bin/tests/system/ecdsa/tests_ecdsa.py b/bin/tests/system/ecdsa/tests_ecdsa.py index 08b4ee0e68..95fcaf9856 100644 --- a/bin/tests/system/ecdsa/tests_ecdsa.py +++ b/bin/tests/system/ecdsa/tests_ecdsa.py @@ -10,9 +10,9 @@ # information regarding copyright ownership. import os -import pytest import dns.flags +import pytest import isctest diff --git a/bin/tests/system/filters/common.py b/bin/tests/system/filters/common.py index e5ff22e977..6db8f19756 100644 --- a/bin/tests/system/filters/common.py +++ b/bin/tests/system/filters/common.py @@ -9,9 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import dns from dns import rdataclass, rdatatype +import dns + import isctest ARTIFACTS = [ diff --git a/bin/tests/system/filters/tests_filter_a_v4.py b/bin/tests/system/filters/tests_filter_a_v4.py index cb690eb352..e38a4f1422 100644 --- a/bin/tests/system/filters/tests_filter_a_v4.py +++ b/bin/tests/system/filters/tests_filter_a_v4.py @@ -11,8 +11,6 @@ import pytest -import isctest.mark - from filters.common import ( ARTIFACTS, check_filter, @@ -20,6 +18,8 @@ from filters.common import ( prime_cache, ) +import isctest.mark + pytestmark = pytest.mark.extra_artifacts(ARTIFACTS) diff --git a/bin/tests/system/filters/tests_filter_a_v6.py b/bin/tests/system/filters/tests_filter_a_v6.py index 1d33f2fd05..69d56c0dae 100644 --- a/bin/tests/system/filters/tests_filter_a_v6.py +++ b/bin/tests/system/filters/tests_filter_a_v6.py @@ -11,8 +11,6 @@ import pytest -import isctest.mark - from filters.common import ( ARTIFACTS, check_filter, @@ -20,6 +18,8 @@ from filters.common import ( prime_cache, ) +import isctest.mark + pytestmark = pytest.mark.extra_artifacts(ARTIFACTS) diff --git a/bin/tests/system/filters/tests_filter_aaaa_v4.py b/bin/tests/system/filters/tests_filter_aaaa_v4.py index 3c783a9cf3..adf46add04 100644 --- a/bin/tests/system/filters/tests_filter_aaaa_v4.py +++ b/bin/tests/system/filters/tests_filter_aaaa_v4.py @@ -11,9 +11,6 @@ import pytest -import isctest -import isctest.mark - from filters.common import ( ARTIFACTS, check_filter, @@ -21,6 +18,9 @@ from filters.common import ( prime_cache, ) +import isctest +import isctest.mark + pytestmark = pytest.mark.extra_artifacts(ARTIFACTS) diff --git a/bin/tests/system/filters/tests_filter_aaaa_v6.py b/bin/tests/system/filters/tests_filter_aaaa_v6.py index b973724e14..001a0dd5bf 100644 --- a/bin/tests/system/filters/tests_filter_aaaa_v6.py +++ b/bin/tests/system/filters/tests_filter_aaaa_v6.py @@ -11,8 +11,6 @@ import pytest -import isctest.mark - from filters.common import ( ARTIFACTS, check_filter, @@ -20,6 +18,8 @@ from filters.common import ( prime_cache, ) +import isctest.mark + pytestmark = pytest.mark.extra_artifacts(ARTIFACTS) diff --git a/bin/tests/system/filters/tests_filter_checkconf.py b/bin/tests/system/filters/tests_filter_checkconf.py index de5eae132f..46ab794c8a 100644 --- a/bin/tests/system/filters/tests_filter_checkconf.py +++ b/bin/tests/system/filters/tests_filter_checkconf.py @@ -15,10 +15,10 @@ import subprocess import pytest -import isctest - from filters.common import ARTIFACTS +import isctest + pytestmark = pytest.mark.extra_artifacts(ARTIFACTS) diff --git a/bin/tests/system/filters/tests_filter_dns64.py b/bin/tests/system/filters/tests_filter_dns64.py index 39c0bbc603..dfa71b76c1 100644 --- a/bin/tests/system/filters/tests_filter_dns64.py +++ b/bin/tests/system/filters/tests_filter_dns64.py @@ -11,10 +11,10 @@ import pytest -import isctest - from filters.common import ARTIFACTS +import isctest + pytestmark = pytest.mark.extra_artifacts(ARTIFACTS) diff --git a/bin/tests/system/isctest/__init__.py b/bin/tests/system/isctest/__init__.py index 4b5f299376..c5e4fc0ed5 100644 --- a/bin/tests/system/isctest/__init__.py +++ b/bin/tests/system/isctest/__init__.py @@ -9,15 +9,17 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -from . import check -from . import instance -from . import hypothesis -from . import query -from . import kasp -from . import run -from . import template -from . import log -from . import vars # pylint: disable=redefined-builtin +from . import ( # pylint: disable=redefined-builtin + check, + hypothesis, + instance, + kasp, + log, + query, + run, + template, + vars, +) # isctest.mark module is intentionally NOT imported, because it relies on # environment variables which might not be set at the time of import of the diff --git a/bin/tests/system/isctest/asyncserver.py b/bin/tests/system/isctest/asyncserver.py index 8e4ea245e5..72979399a6 100644 --- a/bin/tests/system/isctest/asyncserver.py +++ b/bin/tests/system/isctest/asyncserver.py @@ -20,8 +20,8 @@ from typing import ( Dict, List, Optional, - Set, Sequence, + Set, Tuple, Union, cast, diff --git a/bin/tests/system/isctest/check.py b/bin/tests/system/isctest/check.py index d6a222aded..b2a7466351 100644 --- a/bin/tests/system/isctest/check.py +++ b/bin/tests/system/isctest/check.py @@ -9,12 +9,14 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +from typing import List, Optional, cast + import difflib import shutil -from typing import cast, List, Optional + +from dns.edns import EDECode, EDEOption import dns.edns -from dns.edns import EDECode, EDEOption import dns.flags import dns.message import dns.rcode diff --git a/bin/tests/system/isctest/hypothesis/__init__.py b/bin/tests/system/isctest/hypothesis/__init__.py index 6c2cc00210..e4cda09629 100644 --- a/bin/tests/system/isctest/hypothesis/__init__.py +++ b/bin/tests/system/isctest/hypothesis/__init__.py @@ -12,5 +12,4 @@ # This ensures we're using a suitable hypothesis version. A newer version is # required for FIPS-enabled platforms. -from . import settings -from . import strategies +from . import settings, strategies diff --git a/bin/tests/system/isctest/hypothesis/strategies.py b/bin/tests/system/isctest/hypothesis/strategies.py index e8badc6802..1a00851889 100644 --- a/bin/tests/system/isctest/hypothesis/strategies.py +++ b/bin/tests/system/isctest/hypothesis/strategies.py @@ -11,10 +11,11 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import collections.abc from typing import List, Union from warnings import warn +import collections.abc + from hypothesis.strategies import ( binary, builds, @@ -26,8 +27,8 @@ from hypothesis.strategies import ( sampled_from, ) -import dns.name import dns.message +import dns.name import dns.rdataclass import dns.rdatatype diff --git a/bin/tests/system/isctest/instance.py b/bin/tests/system/isctest/instance.py index 129a2a907a..58e027fe8e 100644 --- a/bin/tests/system/isctest/instance.py +++ b/bin/tests/system/isctest/instance.py @@ -11,18 +11,18 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +from pathlib import Path from typing import List, NamedTuple, Optional import os -from pathlib import Path import re -import dns.update import dns.rcode +import dns.update -from .log import debug, WatchLogFromStart, WatchLogFromHere -from .run import CmdResult, EnvCmd, perl +from .log import WatchLogFromHere, WatchLogFromStart, debug from .query import udp +from .run import CmdResult, EnvCmd, perl from .text import TextFile diff --git a/bin/tests/system/isctest/kasp.py b/bin/tests/system/isctest/kasp.py index 8098afecb6..f5e8160dd9 100644 --- a/bin/tests/system/isctest/kasp.py +++ b/bin/tests/system/isctest/kasp.py @@ -11,13 +11,14 @@ from datetime import datetime, timedelta, timezone from functools import total_ordering +from pathlib import Path +from re import compile as Re +from typing import Dict, List, Optional, Tuple, Union + import glob import os -from pathlib import Path import re -from re import compile as Re import time -from typing import Dict, List, Optional, Tuple, Union import dns import dns.dnssec @@ -25,12 +26,13 @@ import dns.rdatatype import dns.rrset import dns.tsig +from isctest.instance import NamedInstance +from isctest.template import TrustAnchor +from isctest.vars.algorithms import ALL_ALGORITHMS_BY_NUM, Algorithm + import isctest.log import isctest.query import isctest.util -from isctest.instance import NamedInstance -from isctest.template import TrustAnchor -from isctest.vars.algorithms import Algorithm, ALL_ALGORITHMS_BY_NUM DEFAULT_TTL = 300 diff --git a/bin/tests/system/isctest/log/__init__.py b/bin/tests/system/isctest/log/__init__.py index 228f69e5bf..45ec242e39 100644 --- a/bin/tests/system/isctest/log/__init__.py +++ b/bin/tests/system/isctest/log/__init__.py @@ -11,16 +11,15 @@ from .basic import ( avoid_duplicated_logs, + critical, + debug, deinit_module_logger, deinit_test_logger, + error, + info, init_conftest_logger, init_module_logger, init_test_logger, - debug, - info, warning, - error, - critical, ) - -from .watchlog import WatchLogFromStart, WatchLogFromHere +from .watchlog import WatchLogFromHere, WatchLogFromStart diff --git a/bin/tests/system/isctest/log/basic.py b/bin/tests/system/isctest/log/basic.py index 812e83e254..89201f61c7 100644 --- a/bin/tests/system/isctest/log/basic.py +++ b/bin/tests/system/isctest/log/basic.py @@ -9,11 +9,12 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import logging from pathlib import Path -import textwrap from typing import Dict, Optional +import logging +import textwrap + LOG_FORMAT = "%(asctime)s %(levelname)7s:%(name)s %(message)s" LOG_INDENT = 4 diff --git a/bin/tests/system/isctest/log/watchlog.py b/bin/tests/system/isctest/log/watchlog.py index d7154995b7..5c2bab0f20 100644 --- a/bin/tests/system/isctest/log/watchlog.py +++ b/bin/tests/system/isctest/log/watchlog.py @@ -15,7 +15,7 @@ import abc import os import time -from isctest.text import compile_pattern, FlexPattern, LineReader +from isctest.text import FlexPattern, LineReader, compile_pattern T = TypeVar("T") OneOrMore = Union[T, List[T]] diff --git a/bin/tests/system/isctest/mark.py b/bin/tests/system/isctest/mark.py index 4d7fcce147..81f3774972 100644 --- a/bin/tests/system/isctest/mark.py +++ b/bin/tests/system/isctest/mark.py @@ -11,11 +11,12 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import os from pathlib import Path + +import os import platform -import socket import shutil +import socket import subprocess import pytest diff --git a/bin/tests/system/isctest/name.py b/bin/tests/system/isctest/name.py index cc836f85db..cc80f44d79 100644 --- a/bin/tests/system/isctest/name.py +++ b/bin/tests/system/isctest/name.py @@ -9,14 +9,14 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -from typing import Iterable, FrozenSet - -import dns.name -import dns.zone -import dns.rdatatype +from typing import FrozenSet, Iterable from dns.name import Name +import dns.name +import dns.rdatatype +import dns.zone + def prepend_label(label: str, name: Name) -> Name: return Name((label,) + name.labels) diff --git a/bin/tests/system/isctest/query.py b/bin/tests/system/isctest/query.py index daa8ade014..f8a62150c4 100644 --- a/bin/tests/system/isctest/query.py +++ b/bin/tests/system/isctest/query.py @@ -9,12 +9,13 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import os -import time from typing import Any, Callable, Optional -import dns.query +import os +import time + import dns.message +import dns.query import isctest.log diff --git a/bin/tests/system/isctest/run.py b/bin/tests/system/isctest/run.py index 65fd5ec8df..7c7559726d 100644 --- a/bin/tests/system/isctest/run.py +++ b/bin/tests/system/isctest/run.py @@ -9,11 +9,12 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import os from pathlib import Path +from typing import List, Optional + +import os import subprocess import time -from typing import List, Optional import isctest.log import isctest.text diff --git a/bin/tests/system/isctest/text.py b/bin/tests/system/isctest/text.py index 33798c3703..549f06ff7f 100644 --- a/bin/tests/system/isctest/text.py +++ b/bin/tests/system/isctest/text.py @@ -11,11 +11,12 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import abc -import re from re import compile as Re from typing import Iterator, List, Match, Optional, Pattern, TextIO, Union +import abc +import re + FlexPattern = Union[str, Pattern] diff --git a/bin/tests/system/isctest/vars/__init__.py b/bin/tests/system/isctest/vars/__init__.py index 3ebaf3df5e..3fea2f345c 100644 --- a/bin/tests/system/isctest/vars/__init__.py +++ b/bin/tests/system/isctest/vars/__init__.py @@ -11,11 +11,11 @@ import os -from .all import ALL +from .. import log from .algorithms import init_crypto_supported, set_algorithm_set +from .all import ALL from .features import init_features from .openssl import parse_openssl_config -from .. import log def init_vars(): diff --git a/bin/tests/system/isctest/vars/algorithms.py b/bin/tests/system/isctest/vars/algorithms.py index 446ab09d69..65740b86a2 100644 --- a/bin/tests/system/isctest/vars/algorithms.py +++ b/bin/tests/system/isctest/vars/algorithms.py @@ -9,16 +9,17 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +from typing import Dict, List, NamedTuple, Optional, Union + import os import platform import random import subprocess import tempfile import time -from typing import Dict, List, NamedTuple, Optional, Union -from .basic import BASIC_VARS from .. import log +from .basic import BASIC_VARS # Algorithms are selected randomly at runtime from a list of supported # algorithms. The randomization is deterministic and remains stable for a diff --git a/bin/tests/system/isctest/vars/all.py b/bin/tests/system/isctest/vars/all.py index 9dedeec8f8..d295aef0b1 100644 --- a/bin/tests/system/isctest/vars/all.py +++ b/bin/tests/system/isctest/vars/all.py @@ -11,8 +11,8 @@ from collections import ChainMap -from .autoconf import AC_VARS # type: ignore from .algorithms import ALG_VARS, CRYPTO_SUPPORTED_VARS +from .autoconf import AC_VARS # type: ignore from .basic import BASIC_VARS from .dirs import DIR_VARS from .features import FEATURE_VARS diff --git a/bin/tests/system/isctest/vars/basic.py b/bin/tests/system/isctest/vars/basic.py index 05790e044d..b8e97787ee 100644 --- a/bin/tests/system/isctest/vars/basic.py +++ b/bin/tests/system/isctest/vars/basic.py @@ -13,7 +13,6 @@ import os from .autoconf import AC_VARS # type: ignore - BASIC_VARS = { "ARPANAME": f"{AC_VARS['TOP_BUILDDIR']}/bin/tools/arpaname", "CDS": f"{AC_VARS['TOP_BUILDDIR']}/bin/dnssec/dnssec-cds", diff --git a/bin/tests/system/isctest/vars/dirs.py b/bin/tests/system/isctest/vars/dirs.py index 1d6f6fbdf3..f04f478483 100644 --- a/bin/tests/system/isctest/vars/dirs.py +++ b/bin/tests/system/isctest/vars/dirs.py @@ -13,7 +13,6 @@ import os from .autoconf import AC_VARS # type: ignore - SYSTEM_TEST_DIR_GIT_PATH = "bin/tests/system" DIR_VARS = { diff --git a/bin/tests/system/isctest/vars/openssl.py b/bin/tests/system/isctest/vars/openssl.py index b84f526dd8..1287b0bb35 100644 --- a/bin/tests/system/isctest/vars/openssl.py +++ b/bin/tests/system/isctest/vars/openssl.py @@ -9,10 +9,11 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import os from re import compile as Re from typing import Optional +import os + from .. import log OPENSSL_VARS = { diff --git a/bin/tests/system/ixfr-nonminimal/ans2/ans.py b/bin/tests/system/ixfr-nonminimal/ans2/ans.py index 207b5e49ff..aa8b009499 100644 --- a/bin/tests/system/ixfr-nonminimal/ans2/ans.py +++ b/bin/tests/system/ixfr-nonminimal/ans2/ans.py @@ -11,6 +11,8 @@ See the COPYRIGHT file distributed with this work for additional information regarding copyright ownership. """ +from typing import AsyncGenerator, Collection, Iterable + import abc import dns.rcode @@ -18,8 +20,6 @@ import dns.rdataclass import dns.rdatatype import dns.rrset -from typing import AsyncGenerator, Collection, Iterable - from isctest.asyncserver import ( ControllableAsyncDnsServer, DnsResponseSend, diff --git a/bin/tests/system/ixfr-nonminimal/ans4/ans.py b/bin/tests/system/ixfr-nonminimal/ans4/ans.py index 769600ec94..373985aeac 100644 --- a/bin/tests/system/ixfr-nonminimal/ans4/ans.py +++ b/bin/tests/system/ixfr-nonminimal/ans4/ans.py @@ -11,6 +11,8 @@ See the COPYRIGHT file distributed with this work for additional information regarding copyright ownership. """ +from typing import AsyncGenerator, Collection, Iterable + import abc import dns.rcode @@ -18,8 +20,6 @@ import dns.rdataclass import dns.rdatatype import dns.rrset -from typing import AsyncGenerator, Collection, Iterable - from isctest.asyncserver import ( ControllableAsyncDnsServer, DnsResponseSend, diff --git a/bin/tests/system/kasp/tests_kasp.py b/bin/tests/system/kasp/tests_kasp.py index c233f0b3b4..42c7ec9544 100644 --- a/bin/tests/system/kasp/tests_kasp.py +++ b/bin/tests/system/kasp/tests_kasp.py @@ -9,26 +9,24 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +from datetime import timedelta + import os import shutil import subprocess import time -from datetime import timedelta - import dns import dns.update import pytest -import isctest -import isctest.mark -from isctest.kasp import ( - KeyProperties, - KeyTimingMetadata, -) +from isctest.kasp import KeyProperties, KeyTimingMetadata from isctest.util import param from isctest.vars.algorithms import ECDSAP256SHA256, ECDSAP384SHA384 +import isctest +import isctest.mark + pytestmark = pytest.mark.extra_artifacts( [ "K*.private", diff --git a/bin/tests/system/keepalive/tests_keepalive.py b/bin/tests/system/keepalive/tests_keepalive.py index 7a90c7cb43..92657515a9 100644 --- a/bin/tests/system/keepalive/tests_keepalive.py +++ b/bin/tests/system/keepalive/tests_keepalive.py @@ -9,9 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import isctest import pytest +import isctest + pytestmark = pytest.mark.extra_artifacts( ["ns2/named.stats"], ) diff --git a/bin/tests/system/keyfromlabel/tests_keyfromlabel.py b/bin/tests/system/keyfromlabel/tests_keyfromlabel.py index 44f14077ed..5ddf80334a 100644 --- a/bin/tests/system/keyfromlabel/tests_keyfromlabel.py +++ b/bin/tests/system/keyfromlabel/tests_keyfromlabel.py @@ -9,9 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +from re import compile as Re + import hashlib import os -from re import compile as Re import shutil import pytest diff --git a/bin/tests/system/ksr/tests_ksr.py b/bin/tests/system/ksr/tests_ksr.py index fd5f17ae4c..4eacfc925e 100644 --- a/bin/tests/system/ksr/tests_ksr.py +++ b/bin/tests/system/ksr/tests_ksr.py @@ -10,6 +10,7 @@ # information regarding copyright ownership. from datetime import timedelta + import os import re import shutil @@ -17,9 +18,10 @@ import time import pytest -import isctest from isctest.kasp import KeyTimingMetadata +import isctest + pytestmark = pytest.mark.extra_artifacts( [ "K*", diff --git a/bin/tests/system/limits/tests_limits.py b/bin/tests/system/limits/tests_limits.py index 6949838ec7..512c02ecca 100644 --- a/bin/tests/system/limits/tests_limits.py +++ b/bin/tests/system/limits/tests_limits.py @@ -11,10 +11,10 @@ import itertools -import isctest +import dns.rrset import pytest -import dns.rrset +import isctest @pytest.mark.parametrize( diff --git a/bin/tests/system/migrate2kasp/tests_migrate2kasp.py b/bin/tests/system/migrate2kasp/tests_migrate2kasp.py index cb5f6e2051..76c670fafb 100644 --- a/bin/tests/system/migrate2kasp/tests_migrate2kasp.py +++ b/bin/tests/system/migrate2kasp/tests_migrate2kasp.py @@ -9,9 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import os from datetime import timedelta +import os + import pytest import isctest diff --git a/bin/tests/system/multisigner/tests_multisigner.py b/bin/tests/system/multisigner/tests_multisigner.py index d20cdff8d4..f2b5cd7e32 100644 --- a/bin/tests/system/multisigner/tests_multisigner.py +++ b/bin/tests/system/multisigner/tests_multisigner.py @@ -10,13 +10,13 @@ # information regarding copyright ownership. from datetime import timedelta -import os from re import compile as Re -import pytest +import os import dns import dns.update +import pytest import isctest diff --git a/bin/tests/system/nsec3-answer/tests_nsec3.py b/bin/tests/system/nsec3-answer/tests_nsec3.py index ebd0ea6623..c926d053f1 100755 --- a/bin/tests/system/nsec3-answer/tests_nsec3.py +++ b/bin/tests/system/nsec3-answer/tests_nsec3.py @@ -16,11 +16,12 @@ # pylint: disable=unreachable from dataclasses import dataclass -import os from pathlib import Path from typing import Container, Iterable, Optional, Set, Tuple -import pytest +import os + +from hypothesis import assume, given import dns.dnssec import dns.message @@ -29,16 +30,16 @@ import dns.query import dns.rcode import dns.rdataclass import dns.rdatatype -import dns.rdtypes.ANY.RRSIG import dns.rdtypes.ANY.NSEC3 +import dns.rdtypes.ANY.RRSIG import dns.rrset +import pytest from isctest.hypothesis.strategies import dns_names, sampled_from + import isctest import isctest.name -from hypothesis import assume, given - SUFFIX = dns.name.from_text(".") AUTH = "10.53.0.1" RESOLVER = "10.53.0.2" diff --git a/bin/tests/system/nsec3/common.py b/bin/tests/system/nsec3/common.py index ac5bb9c5f3..8cfa672d4d 100644 --- a/bin/tests/system/nsec3/common.py +++ b/bin/tests/system/nsec3/common.py @@ -9,10 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import os - from datetime import timedelta +import os + import dns import pytest diff --git a/bin/tests/system/nsec3/tests_nsec3_change.py b/bin/tests/system/nsec3/tests_nsec3_change.py index d5ec16f5b4..beaea9554d 100644 --- a/bin/tests/system/nsec3/tests_nsec3_change.py +++ b/bin/tests/system/nsec3/tests_nsec3_change.py @@ -19,16 +19,11 @@ import dns import dns.update import pytest +from isctest.vars.algorithms import RSASHA1 +from nsec3.common import ALGORITHM, SIZE, check_nsec3_case, default_config, pytestmark + import isctest import isctest.mark -from isctest.vars.algorithms import RSASHA1 -from nsec3.common import ( - ALGORITHM, - SIZE, - default_config, - pytestmark, - check_nsec3_case, -) # include the following zones when rendering named configs ZONES = { diff --git a/bin/tests/system/nsec3/tests_nsec3_initial.py b/bin/tests/system/nsec3/tests_nsec3_initial.py index 42c0f2b2ae..7f9b4c3e8d 100644 --- a/bin/tests/system/nsec3/tests_nsec3_initial.py +++ b/bin/tests/system/nsec3/tests_nsec3_initial.py @@ -17,16 +17,11 @@ import dns import dns.update import pytest +from isctest.vars.algorithms import RSASHA1 +from nsec3.common import ALGORITHM, SIZE, check_nsec3_case, default_config, pytestmark + import isctest import isctest.mark -from isctest.vars.algorithms import RSASHA1 -from nsec3.common import ( - ALGORITHM, - SIZE, - default_config, - pytestmark, - check_nsec3_case, -) # include the following zones when rendering named configs ZONES = { diff --git a/bin/tests/system/nsec3/tests_nsec3_reconfig.py b/bin/tests/system/nsec3/tests_nsec3_reconfig.py index cb75f1caa4..a725039ed4 100644 --- a/bin/tests/system/nsec3/tests_nsec3_reconfig.py +++ b/bin/tests/system/nsec3/tests_nsec3_reconfig.py @@ -19,16 +19,11 @@ import dns import dns.update import pytest +from isctest.vars.algorithms import RSASHA1 +from nsec3.common import ALGORITHM, SIZE, check_nsec3_case, default_config, pytestmark + import isctest import isctest.mark -from isctest.vars.algorithms import RSASHA1 -from nsec3.common import ( - ALGORITHM, - SIZE, - default_config, - pytestmark, - check_nsec3_case, -) # include the following zones when rendering named configs ZONES = { diff --git a/bin/tests/system/nsec3/tests_nsec3_reload.py b/bin/tests/system/nsec3/tests_nsec3_reload.py index 33171932bd..d23d7df64b 100644 --- a/bin/tests/system/nsec3/tests_nsec3_reload.py +++ b/bin/tests/system/nsec3/tests_nsec3_reload.py @@ -18,12 +18,9 @@ import time import dns import pytest +from nsec3.common import ALGORITHM, SIZE, check_nsec3_case + import isctest -from nsec3.common import ( - ALGORITHM, - SIZE, - check_nsec3_case, -) # include the following zones when rendering named configs ZONES = { diff --git a/bin/tests/system/nsec3/tests_nsec3_restart.py b/bin/tests/system/nsec3/tests_nsec3_restart.py index 9771fd5812..63c6538172 100644 --- a/bin/tests/system/nsec3/tests_nsec3_restart.py +++ b/bin/tests/system/nsec3/tests_nsec3_restart.py @@ -17,17 +17,18 @@ import dns import dns.update import pytest -import isctest -import isctest.mark from nsec3.common import ( ALGORITHM, SIZE, - default_config, - pytestmark, check_nsec3_case, check_nsec3param, + default_config, + pytestmark, ) +import isctest +import isctest.mark + # include the following zones when rendering named configs ZONES = { "nsec3.kasp", diff --git a/bin/tests/system/nsec3/tests_nsec3_retransfer.py b/bin/tests/system/nsec3/tests_nsec3_retransfer.py index c4b9b3284c..cd5aca5224 100644 --- a/bin/tests/system/nsec3/tests_nsec3_retransfer.py +++ b/bin/tests/system/nsec3/tests_nsec3_retransfer.py @@ -12,6 +12,7 @@ # pylint: disable=redefined-outer-name,unused-import from datetime import timedelta + import os import shutil @@ -19,14 +20,11 @@ import dns import dns.update import pytest +from isctest.vars.algorithms import RSASHA256 +from nsec3.common import check_auth_nsec3, check_nsec3param, pytestmark + import isctest import isctest.mark -from isctest.vars.algorithms import RSASHA256 -from nsec3.common import ( - pytestmark, - check_auth_nsec3, - check_nsec3param, -) DNSKEY_TTL = int(timedelta(hours=1).total_seconds()) ZSK_LIFETIME = int(timedelta(days=90).total_seconds()) diff --git a/bin/tests/system/nsupdate/ans4/ans.py b/bin/tests/system/nsupdate/ans4/ans.py index ab066c4bee..da1f43886b 100644 --- a/bin/tests/system/nsupdate/ans4/ans.py +++ b/bin/tests/system/nsupdate/ans4/ans.py @@ -9,11 +9,7 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -from isctest.asyncserver import ( - AsyncDnsServer, - IgnoreAllConnections, - IgnoreAllQueries, -) +from isctest.asyncserver import AsyncDnsServer, IgnoreAllConnections, IgnoreAllQueries def main() -> None: diff --git a/bin/tests/system/nzd2nzf/tests_nzd2nzf.py b/bin/tests/system/nzd2nzf/tests_nzd2nzf.py index 790e937556..54e5a2c95b 100644 --- a/bin/tests/system/nzd2nzf/tests_nzd2nzf.py +++ b/bin/tests/system/nzd2nzf/tests_nzd2nzf.py @@ -11,6 +11,7 @@ import os + import pytest import isctest diff --git a/bin/tests/system/optout/tests_optout.py b/bin/tests/system/optout/tests_optout.py index 1cc0132e3e..3944649f2d 100755 --- a/bin/tests/system/optout/tests_optout.py +++ b/bin/tests/system/optout/tests_optout.py @@ -16,9 +16,6 @@ import os import re import sys -import isctest -import pytest - import dns import dns.exception import dns.message @@ -27,6 +24,9 @@ import dns.query import dns.rcode import dns.rdataclass import dns.rdatatype +import pytest + +import isctest pytestmark = [ pytest.mark.skipif( diff --git a/bin/tests/system/re_compile_checker.py b/bin/tests/system/re_compile_checker.py index 5dd214f18e..447f88e17e 100644 --- a/bin/tests/system/re_compile_checker.py +++ b/bin/tests/system/re_compile_checker.py @@ -14,7 +14,6 @@ import re from astroid import nodes - from pylint.checkers import BaseRawFileChecker from pylint.lint import PyLinter diff --git a/bin/tests/system/resolver/ans2/ans.py b/bin/tests/system/resolver/ans2/ans.py index 052f212f1c..a94a99ce29 100644 --- a/bin/tests/system/resolver/ans2/ans.py +++ b/bin/tests/system/resolver/ans2/ans.py @@ -15,8 +15,8 @@ from typing import AsyncGenerator, Tuple, Union import dns.name import dns.rcode -import dns.rrset import dns.rdatatype +import dns.rrset from isctest.asyncserver import ( AsyncDnsServer, @@ -26,8 +26,8 @@ from isctest.asyncserver import ( QnameHandler, QnameQtypeHandler, QueryContext, - StaticResponseHandler, ResponseHandler, + StaticResponseHandler, ) from ..resolver_ans import ( diff --git a/bin/tests/system/resolver/ans3/ans.py b/bin/tests/system/resolver/ans3/ans.py index f3143f512d..36172f7685 100644 --- a/bin/tests/system/resolver/ans3/ans.py +++ b/bin/tests/system/resolver/ans3/ans.py @@ -25,8 +25,8 @@ from isctest.asyncserver import ( QnameHandler, QnameQtypeHandler, QueryContext, - StaticResponseHandler, ResponseHandler, + StaticResponseHandler, ) from ..resolver_ans import ( diff --git a/bin/tests/system/resolver/ans8/ans.py b/bin/tests/system/resolver/ans8/ans.py index 7d677265fa..6ef65f2157 100644 --- a/bin/tests/system/resolver/ans8/ans.py +++ b/bin/tests/system/resolver/ans8/ans.py @@ -11,10 +11,10 @@ See the COPYRIGHT file distributed with this work for additional information regarding copyright ownership. """ -import abc - from typing import AsyncGenerator +import abc + import dns.flags import dns.message import dns.rcode @@ -22,8 +22,8 @@ import dns.rdatatype from isctest.asyncserver import ( AsyncDnsServer, - DnsResponseSend, DnsProtocol, + DnsResponseSend, DomainHandler, QnameHandler, QnameQtypeHandler, diff --git a/bin/tests/system/rfc5011/tests_rfc5011.py b/bin/tests/system/rfc5011/tests_rfc5011.py index 652293792b..35a73f14cd 100644 --- a/bin/tests/system/rfc5011/tests_rfc5011.py +++ b/bin/tests/system/rfc5011/tests_rfc5011.py @@ -10,6 +10,7 @@ # information regarding copyright ownership. import pytest + from isctest.mark import live_internet_test pytestmark = pytest.mark.extra_artifacts( diff --git a/bin/tests/system/rollover-algo-csk/tests_rollover_algo_csk_initial.py b/bin/tests/system/rollover-algo-csk/tests_rollover_algo_csk_initial.py index 131933f40f..ae610eeae5 100644 --- a/bin/tests/system/rollover-algo-csk/tests_rollover_algo_csk_initial.py +++ b/bin/tests/system/rollover-algo-csk/tests_rollover_algo_csk_initial.py @@ -13,20 +13,11 @@ import pytest -import isctest from isctest.util import param -from rollover.common import ( - pytestmark, - CDSS, - DURATION, - TIMEDELTA, - ALGOROLL_CONFIG, -) -from rollover.setup import ( - configure_root, - configure_tld, - configure_algo_csk, -) +from rollover.common import ALGOROLL_CONFIG, CDSS, DURATION, TIMEDELTA, pytestmark +from rollover.setup import configure_algo_csk, configure_root, configure_tld + +import isctest POLICY = "csk-algoroll" diff --git a/bin/tests/system/rollover-algo-csk/tests_rollover_algo_csk_reconfig.py b/bin/tests/system/rollover-algo-csk/tests_rollover_algo_csk_reconfig.py index 8c7c2badba..f1420f6934 100644 --- a/bin/tests/system/rollover-algo-csk/tests_rollover_algo_csk_reconfig.py +++ b/bin/tests/system/rollover-algo-csk/tests_rollover_algo_csk_reconfig.py @@ -13,14 +13,9 @@ import pytest -import isctest from isctest.kasp import KeyTimingMetadata from isctest.util import param from rollover.common import ( - pytestmark, - alg, - size, - CDSS, ALGOROLL_CONFIG, ALGOROLL_IPUB, ALGOROLL_IPUBC, @@ -29,14 +24,16 @@ from rollover.common import ( ALGOROLL_KEYTTLPROP, ALGOROLL_OFFSETS, ALGOROLL_OFFVAL, + CDSS, DURATION, TIMEDELTA, + alg, + pytestmark, + size, ) -from rollover.setup import ( - configure_root, - configure_tld, - configure_algo_csk, -) +from rollover.setup import configure_algo_csk, configure_root, configure_tld + +import isctest CONFIG = ALGOROLL_CONFIG POLICY = "csk-algoroll" diff --git a/bin/tests/system/rollover-algo-ksk-zsk/tests_rollover_algo_ksk_zsk_initial.py b/bin/tests/system/rollover-algo-ksk-zsk/tests_rollover_algo_ksk_zsk_initial.py index 2f74cd0fa4..4abef13fca 100644 --- a/bin/tests/system/rollover-algo-ksk-zsk/tests_rollover_algo_ksk_zsk_initial.py +++ b/bin/tests/system/rollover-algo-ksk-zsk/tests_rollover_algo_ksk_zsk_initial.py @@ -13,20 +13,11 @@ import pytest -import isctest from isctest.util import param -from rollover.common import ( - pytestmark, - CDSS, - DURATION, - TIMEDELTA, - ALGOROLL_CONFIG, -) -from rollover.setup import ( - configure_root, - configure_tld, - configure_algo_ksk_zsk, -) +from rollover.common import ALGOROLL_CONFIG, CDSS, DURATION, TIMEDELTA, pytestmark +from rollover.setup import configure_algo_ksk_zsk, configure_root, configure_tld + +import isctest def bootstrap(): diff --git a/bin/tests/system/rollover-algo-ksk-zsk/tests_rollover_algo_ksk_zsk_reconfig.py b/bin/tests/system/rollover-algo-ksk-zsk/tests_rollover_algo_ksk_zsk_reconfig.py index cfac1739f8..9a5db0fdd2 100644 --- a/bin/tests/system/rollover-algo-ksk-zsk/tests_rollover_algo_ksk_zsk_reconfig.py +++ b/bin/tests/system/rollover-algo-ksk-zsk/tests_rollover_algo_ksk_zsk_reconfig.py @@ -13,14 +13,9 @@ import pytest -import isctest from isctest.kasp import KeyTimingMetadata from isctest.util import param from rollover.common import ( - pytestmark, - alg, - size, - CDSS, ALGOROLL_CONFIG, ALGOROLL_IPUB, ALGOROLL_IPUBC, @@ -29,14 +24,16 @@ from rollover.common import ( ALGOROLL_KEYTTLPROP, ALGOROLL_OFFSETS, ALGOROLL_OFFVAL, + CDSS, DURATION, TIMEDELTA, + alg, + pytestmark, + size, ) -from rollover.setup import ( - configure_root, - configure_tld, - configure_algo_ksk_zsk, -) +from rollover.setup import configure_algo_ksk_zsk, configure_root, configure_tld + +import isctest CONFIG = ALGOROLL_CONFIG POLICY = "ecdsa256" diff --git a/bin/tests/system/rollover-csk-roll1/tests_rollover_csk_roll1.py b/bin/tests/system/rollover-csk-roll1/tests_rollover_csk_roll1.py index b598cd6888..806975b929 100644 --- a/bin/tests/system/rollover-csk-roll1/tests_rollover_csk_roll1.py +++ b/bin/tests/system/rollover-csk-roll1/tests_rollover_csk_roll1.py @@ -15,20 +15,12 @@ from datetime import timedelta import pytest -import isctest from isctest.kasp import Ipub, Iret from isctest.util import param -from rollover.common import ( - pytestmark, - alg, - size, - TIMEDELTA, -) -from rollover.setup import ( - configure_root, - configure_tld, - configure_cskroll1, -) +from rollover.common import TIMEDELTA, alg, pytestmark, size +from rollover.setup import configure_cskroll1, configure_root, configure_tld + +import isctest CDSS = ["CDNSKEY", "CDS (SHA-384)"] CONFIG = { diff --git a/bin/tests/system/rollover-csk-roll2/tests_rollover_csk_roll2.py b/bin/tests/system/rollover-csk-roll2/tests_rollover_csk_roll2.py index 983d382236..1234d1fd37 100644 --- a/bin/tests/system/rollover-csk-roll2/tests_rollover_csk_roll2.py +++ b/bin/tests/system/rollover-csk-roll2/tests_rollover_csk_roll2.py @@ -15,20 +15,12 @@ from datetime import timedelta import pytest -import isctest from isctest.kasp import Ipub, Iret from isctest.util import param -from rollover.common import ( - pytestmark, - alg, - size, - TIMEDELTA, -) -from rollover.setup import ( - configure_root, - configure_tld, - configure_cskroll2, -) +from rollover.common import TIMEDELTA, alg, pytestmark, size +from rollover.setup import configure_cskroll2, configure_root, configure_tld + +import isctest CDSS = ["CDNSKEY", "CDS (SHA-256)", "CDS (SHA-384)"] CONFIG = { diff --git a/bin/tests/system/rollover-dynamic2inline/tests_rollover_dynamic2inline.py b/bin/tests/system/rollover-dynamic2inline/tests_rollover_dynamic2inline.py index 7ec8591195..946a7c1420 100644 --- a/bin/tests/system/rollover-dynamic2inline/tests_rollover_dynamic2inline.py +++ b/bin/tests/system/rollover-dynamic2inline/tests_rollover_dynamic2inline.py @@ -11,14 +11,9 @@ # pylint: disable=redefined-outer-name,unused-import +from rollover.common import CDSS, DEFAULT_CONFIG, alg, pytestmark, size + import isctest -from rollover.common import ( - pytestmark, - alg, - size, - CDSS, - DEFAULT_CONFIG, -) def test_dynamic2inline(alg, size, ns3, templates): diff --git a/bin/tests/system/rollover-enable-dnssec/tests_rollover_enable_dnssec.py b/bin/tests/system/rollover-enable-dnssec/tests_rollover_enable_dnssec.py index 23d47bdbb6..22068f58cd 100644 --- a/bin/tests/system/rollover-enable-dnssec/tests_rollover_enable_dnssec.py +++ b/bin/tests/system/rollover-enable-dnssec/tests_rollover_enable_dnssec.py @@ -13,21 +13,12 @@ import pytest -import isctest from isctest.kasp import Ipub, IpubC, Iret from isctest.util import param -from rollover.common import ( - pytestmark, - alg, - size, - CDSS, - TIMEDELTA, -) -from rollover.setup import ( - configure_root, - configure_tld, - configure_enable_dnssec, -) +from rollover.common import CDSS, TIMEDELTA, alg, pytestmark, size +from rollover.setup import configure_enable_dnssec, configure_root, configure_tld + +import isctest CONFIG = { "dnskey-ttl": TIMEDELTA["PT5M"], diff --git a/bin/tests/system/rollover-going-insecure/tests_rollover_going_insecure_initial.py b/bin/tests/system/rollover-going-insecure/tests_rollover_going_insecure_initial.py index 92950124ed..19f8c0457b 100644 --- a/bin/tests/system/rollover-going-insecure/tests_rollover_going_insecure_initial.py +++ b/bin/tests/system/rollover-going-insecure/tests_rollover_going_insecure_initial.py @@ -13,20 +13,10 @@ import pytest +from rollover.common import CDSS, DURATION, UNSIGNING_CONFIG, alg, pytestmark, size +from rollover.setup import configure_going_insecure, configure_root, configure_tld + import isctest -from rollover.common import ( - pytestmark, - alg, - size, - CDSS, - DURATION, - UNSIGNING_CONFIG, -) -from rollover.setup import ( - configure_root, - configure_tld, - configure_going_insecure, -) def bootstrap(): diff --git a/bin/tests/system/rollover-going-insecure/tests_rollover_going_insecure_reconfig.py b/bin/tests/system/rollover-going-insecure/tests_rollover_going_insecure_reconfig.py index 5cd8d65816..8b27e5ac8e 100644 --- a/bin/tests/system/rollover-going-insecure/tests_rollover_going_insecure_reconfig.py +++ b/bin/tests/system/rollover-going-insecure/tests_rollover_going_insecure_reconfig.py @@ -13,21 +13,18 @@ import pytest -import isctest from rollover.common import ( - pytestmark, - alg, - size, CDSS, DEFAULT_CONFIG, DURATION, UNSIGNING_CONFIG, + alg, + pytestmark, + size, ) -from rollover.setup import ( - configure_root, - configure_tld, - configure_going_insecure, -) +from rollover.setup import configure_going_insecure, configure_root, configure_tld + +import isctest def bootstrap(): diff --git a/bin/tests/system/rollover-ksk-3crowd/tests_rollover_three_is_a_crowd.py b/bin/tests/system/rollover-ksk-3crowd/tests_rollover_three_is_a_crowd.py index dbbf136149..3308858212 100644 --- a/bin/tests/system/rollover-ksk-3crowd/tests_rollover_three_is_a_crowd.py +++ b/bin/tests/system/rollover-ksk-3crowd/tests_rollover_three_is_a_crowd.py @@ -13,22 +13,19 @@ from datetime import timedelta -import isctest from isctest.kasp import KeyTimingMetadata from rollover.common import ( - pytestmark, - alg, - size, KSK_CONFIG, - KSK_LIFETIME_POLICY, KSK_IPUB, KSK_IRET, + KSK_LIFETIME_POLICY, + alg, + pytestmark, + size, ) -from rollover.setup import ( - configure_root, - configure_tld, - configure_ksk_3crowd, -) +from rollover.setup import configure_ksk_3crowd, configure_root, configure_tld + +import isctest CDSS = ["CDS (SHA-256)"] POLICY = "ksk-doubleksk-autosign" diff --git a/bin/tests/system/rollover-ksk-doubleksk/tests_rollover_ksk_doubleksk.py b/bin/tests/system/rollover-ksk-doubleksk/tests_rollover_ksk_doubleksk.py index 46e8524295..8ea0853ea1 100644 --- a/bin/tests/system/rollover-ksk-doubleksk/tests_rollover_ksk_doubleksk.py +++ b/bin/tests/system/rollover-ksk-doubleksk/tests_rollover_ksk_doubleksk.py @@ -15,26 +15,23 @@ from datetime import timedelta import pytest -import isctest from isctest.util import param from rollover.common import ( - pytestmark, - alg, - size, KSK_CONFIG, - KSK_LIFETIME, - KSK_LIFETIME_POLICY, KSK_IPUB, KSK_IPUBC, KSK_IRET, KSK_KEYTTLPROP, + KSK_LIFETIME, + KSK_LIFETIME_POLICY, TIMEDELTA, + alg, + pytestmark, + size, ) -from rollover.setup import ( - configure_root, - configure_tld, - configure_ksk_doubleksk, -) +from rollover.setup import configure_ksk_doubleksk, configure_root, configure_tld + +import isctest CDSS = ["CDS (SHA-256)"] POLICY = "ksk-doubleksk" diff --git a/bin/tests/system/rollover-lifetime/tests_rollover_lifetime_initial.py b/bin/tests/system/rollover-lifetime/tests_rollover_lifetime_initial.py index a7f5ead0fa..b6052c8a17 100644 --- a/bin/tests/system/rollover-lifetime/tests_rollover_lifetime_initial.py +++ b/bin/tests/system/rollover-lifetime/tests_rollover_lifetime_initial.py @@ -13,16 +13,10 @@ import pytest -import isctest from isctest.util import param -from rollover.common import ( - pytestmark, - alg, - size, - CDSS, - DEFAULT_CONFIG, - DURATION, -) +from rollover.common import CDSS, DEFAULT_CONFIG, DURATION, alg, pytestmark, size + +import isctest @pytest.mark.parametrize( diff --git a/bin/tests/system/rollover-lifetime/tests_rollover_lifetime_reconfig.py b/bin/tests/system/rollover-lifetime/tests_rollover_lifetime_reconfig.py index d28a7e4cd5..4da7064973 100644 --- a/bin/tests/system/rollover-lifetime/tests_rollover_lifetime_reconfig.py +++ b/bin/tests/system/rollover-lifetime/tests_rollover_lifetime_reconfig.py @@ -13,16 +13,10 @@ import pytest -import isctest from isctest.util import param -from rollover.common import ( - pytestmark, - alg, - size, - CDSS, - DEFAULT_CONFIG, - DURATION, -) +from rollover.common import CDSS, DEFAULT_CONFIG, DURATION, alg, pytestmark, size + +import isctest @pytest.fixture(scope="module", autouse=True) diff --git a/bin/tests/system/rollover-multisigner/tests_rollover_multisigner.py b/bin/tests/system/rollover-multisigner/tests_rollover_multisigner.py index 1dc112e643..9f59ebc89f 100644 --- a/bin/tests/system/rollover-multisigner/tests_rollover_multisigner.py +++ b/bin/tests/system/rollover-multisigner/tests_rollover_multisigner.py @@ -12,23 +12,20 @@ # pylint: disable=redefined-outer-name,unused-import from datetime import timedelta -import os -import pytest +import os import dns import dns.update +import pytest -import isctest from isctest.kasp import Iret from isctest.run import EnvCmd -from rollover.common import ( - pytestmark, - alg, - size, -) +from rollover.common import alg, pytestmark, size from rollover.setup import fake_lifetime, render_and_sign_zone +import isctest + def bootstrap(): templates = isctest.template.TemplateEngine(".") diff --git a/bin/tests/system/rollover-straight2none/tests_rollover_straight2none_initial.py b/bin/tests/system/rollover-straight2none/tests_rollover_straight2none_initial.py index c38e5ddd49..c34d62aa2c 100644 --- a/bin/tests/system/rollover-straight2none/tests_rollover_straight2none_initial.py +++ b/bin/tests/system/rollover-straight2none/tests_rollover_straight2none_initial.py @@ -13,20 +13,10 @@ import pytest +from rollover.common import CDSS, DEFAULT_CONFIG, DURATION, alg, pytestmark, size +from rollover.setup import configure_root, configure_straight2none, configure_tld + import isctest -from rollover.common import ( - pytestmark, - alg, - size, - CDSS, - DURATION, - DEFAULT_CONFIG, -) -from rollover.setup import ( - configure_root, - configure_tld, - configure_straight2none, -) def bootstrap(): diff --git a/bin/tests/system/rollover-straight2none/tests_rollover_straight2none_reconfig.py b/bin/tests/system/rollover-straight2none/tests_rollover_straight2none_reconfig.py index 5cfb49653b..2d8fbce209 100644 --- a/bin/tests/system/rollover-straight2none/tests_rollover_straight2none_reconfig.py +++ b/bin/tests/system/rollover-straight2none/tests_rollover_straight2none_reconfig.py @@ -13,20 +13,10 @@ import pytest +from rollover.common import CDSS, DEFAULT_CONFIG, DURATION, alg, pytestmark, size +from rollover.setup import configure_root, configure_straight2none, configure_tld + import isctest -from rollover.common import ( - pytestmark, - alg, - size, - CDSS, - DURATION, - DEFAULT_CONFIG, -) -from rollover.setup import ( - configure_root, - configure_tld, - configure_straight2none, -) def bootstrap(): diff --git a/bin/tests/system/rollover-zsk-prepub/tests_rollover_zsk_prepublication.py b/bin/tests/system/rollover-zsk-prepub/tests_rollover_zsk_prepublication.py index 31e0b99e43..6daabfdf85 100644 --- a/bin/tests/system/rollover-zsk-prepub/tests_rollover_zsk_prepublication.py +++ b/bin/tests/system/rollover-zsk-prepub/tests_rollover_zsk_prepublication.py @@ -15,20 +15,12 @@ from datetime import timedelta import pytest -import isctest from isctest.kasp import Ipub, Iret from isctest.util import param -from rollover.common import ( - pytestmark, - alg, - size, - TIMEDELTA, -) -from rollover.setup import ( - configure_root, - configure_tld, - configure_zsk_prepub, -) +from rollover.common import TIMEDELTA, alg, pytestmark, size +from rollover.setup import configure_root, configure_tld, configure_zsk_prepub + +import isctest CONFIG = { "dnskey-ttl": TIMEDELTA["PT1H"], diff --git a/bin/tests/system/rollover/common.py b/bin/tests/system/rollover/common.py index 6fa054a1d7..64bd8f2afc 100644 --- a/bin/tests/system/rollover/common.py +++ b/bin/tests/system/rollover/common.py @@ -10,6 +10,7 @@ # information regarding copyright ownership. from datetime import timedelta + import os import pytest diff --git a/bin/tests/system/rollover/setup.py b/bin/tests/system/rollover/setup.py index ed4b0d1289..42bdf63017 100644 --- a/bin/tests/system/rollover/setup.py +++ b/bin/tests/system/rollover/setup.py @@ -9,15 +9,17 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -import shutil from typing import List -import isctest +import shutil + from isctest.kasp import private_type_record -from isctest.template import Nameserver, TrustAnchor, Zone from isctest.run import EnvCmd +from isctest.template import Nameserver, TrustAnchor, Zone from rollover.common import default_algorithm +import isctest + def configure_tld(zonename: str, delegations: List[Zone]) -> Zone: templates = isctest.template.TemplateEngine(".") diff --git a/bin/tests/system/rollover/tests_rollover_manual.py b/bin/tests/system/rollover/tests_rollover_manual.py index f2c9871f4d..f319511bca 100644 --- a/bin/tests/system/rollover/tests_rollover_manual.py +++ b/bin/tests/system/rollover/tests_rollover_manual.py @@ -10,18 +10,16 @@ # information regarding copyright ownership. from datetime import timedelta + import os -import isctest -from isctest.kasp import KeyTimingMetadata, Ipub, Iret, private_type_record -from isctest.template import Nameserver, Zone +from isctest.kasp import Ipub, Iret, KeyTimingMetadata, private_type_record from isctest.run import EnvCmd - +from isctest.template import Nameserver, Zone from rollover.common import default_algorithm -from rollover.setup import ( - configure_root, - configure_tld, -) +from rollover.setup import configure_root, configure_tld + +import isctest def setup_zone(zone, ksk_time, ksk_settime, zsk_time, zsk_settime) -> Zone: diff --git a/bin/tests/system/rpzextra/tests_rpzextra.py b/bin/tests/system/rpzextra/tests_rpzextra.py index dc2353d039..5eedc45e27 100644 --- a/bin/tests/system/rpzextra/tests_rpzextra.py +++ b/bin/tests/system/rpzextra/tests_rpzextra.py @@ -13,11 +13,10 @@ import os -import pytest - import dns import dns.rcode import dns.rrset +import pytest import isctest diff --git a/bin/tests/system/selftest/tests_zone_analyzer.py b/bin/tests/system/selftest/tests_zone_analyzer.py index 90f76b8416..671ca87751 100755 --- a/bin/tests/system/selftest/tests_zone_analyzer.py +++ b/bin/tests/system/selftest/tests_zone_analyzer.py @@ -14,13 +14,15 @@ isctest.name.ZoneAnalyzer self-test Generate insane test zone and check expected output of ZoneAnalyzer utility class """ +from pathlib import Path + import collections import itertools -from pathlib import Path + +from dns.name import Name import dns import dns.name -from dns.name import Name import pytest import isctest diff --git a/bin/tests/system/shutdown/tests_shutdown.py b/bin/tests/system/shutdown/tests_shutdown.py index 2b5b9d5220..831f85c449 100755 --- a/bin/tests/system/shutdown/tests_shutdown.py +++ b/bin/tests/system/shutdown/tests_shutdown.py @@ -12,17 +12,17 @@ # information regarding copyright ownership. from concurrent.futures import ThreadPoolExecutor, as_completed +from string import ascii_lowercase as letters + import os import random import signal import subprocess -from string import ascii_lowercase as letters import time -import pytest - import dns import dns.exception +import pytest import isctest diff --git a/bin/tests/system/sortlist/tests_sortlist.py b/bin/tests/system/sortlist/tests_sortlist.py index f5c68c86af..137334197e 100644 --- a/bin/tests/system/sortlist/tests_sortlist.py +++ b/bin/tests/system/sortlist/tests_sortlist.py @@ -10,7 +10,6 @@ # information regarding copyright ownership. import dns.message - import pytest import isctest diff --git a/bin/tests/system/statschannel/generic.py b/bin/tests/system/statschannel/generic.py index 09a374e120..3e317087eb 100644 --- a/bin/tests/system/statschannel/generic.py +++ b/bin/tests/system/statschannel/generic.py @@ -9,9 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -from datetime import datetime, timedelta from collections import defaultdict +from datetime import datetime, timedelta from time import sleep + import os import dns.message diff --git a/bin/tests/system/statschannel/tests_xml.py b/bin/tests/system/statschannel/tests_xml.py index 1ceb46f9b4..0707681de7 100755 --- a/bin/tests/system/statschannel/tests_xml.py +++ b/bin/tests/system/statschannel/tests_xml.py @@ -12,6 +12,7 @@ # information regarding copyright ownership. from datetime import datetime + import xml.etree.ElementTree as ET import pytest diff --git a/bin/tests/system/tcp/tests_tcp.py b/bin/tests/system/tcp/tests_tcp.py index 25ee0d0e1b..c8b301f8a8 100644 --- a/bin/tests/system/tcp/tests_tcp.py +++ b/bin/tests/system/tcp/tests_tcp.py @@ -17,11 +17,10 @@ import socket import struct import time -import pytest - import dns import dns.message import dns.query +import pytest pytestmark = pytest.mark.extra_artifacts( [ diff --git a/bin/tests/system/timeouts/tests_tcp_timeouts.py b/bin/tests/system/timeouts/tests_tcp_timeouts.py index 2c0da8514a..ceea7c0a00 100644 --- a/bin/tests/system/timeouts/tests_tcp_timeouts.py +++ b/bin/tests/system/timeouts/tests_tcp_timeouts.py @@ -16,8 +16,6 @@ import socket import time -import pytest - import dns import dns.edns import dns.message @@ -25,6 +23,7 @@ import dns.name import dns.query import dns.rdataclass import dns.rdatatype +import pytest import isctest.mark diff --git a/bin/tests/system/tools/tests_tools_nsec3hash.py b/bin/tests/system/tools/tests_tools_nsec3hash.py index 93670bc48c..d1dd1de053 100644 --- a/bin/tests/system/tools/tests_tools_nsec3hash.py +++ b/bin/tests/system/tools/tests_tools_nsec3hash.py @@ -12,15 +12,15 @@ import os import subprocess +from dns.dnssectypes import NSEC3Hash +from hypothesis import given, settings, strategies + +import dns.dnssec import pytest -import isctest from isctest.hypothesis.strategies import dns_names -from hypothesis import strategies, given, settings - -from dns.dnssectypes import NSEC3Hash -import dns.dnssec +import isctest NSEC3HASH = os.environ.get("NSEC3HASH") diff --git a/bin/tests/system/tsig/tests_badtime.py b/bin/tests/system/tsig/tests_badtime.py index 4c3a62c9d8..60a47f55cb 100644 --- a/bin/tests/system/tsig/tests_badtime.py +++ b/bin/tests/system/tsig/tests_badtime.py @@ -16,11 +16,10 @@ import socket import time -import pytest - import dns.message import dns.query import dns.tsigkeyring +import pytest pytestmark = pytest.mark.extra_artifacts( [ diff --git a/bin/tests/system/tsig/tests_tsig_hypothesis.py b/bin/tests/system/tsig/tests_tsig_hypothesis.py index 5d31b58339..a7107c87fc 100644 --- a/bin/tests/system/tsig/tests_tsig_hypothesis.py +++ b/bin/tests/system/tsig/tests_tsig_hypothesis.py @@ -17,7 +17,8 @@ import time -import pytest +from hypothesis import assume, example, given +from hypothesis.strategies import binary, booleans, composite, just, sampled_from import dns.exception import dns.message @@ -27,12 +28,11 @@ import dns.rdatatype import dns.rdtypes.ANY.TSIG import dns.rrset import dns.tsig +import pytest -import isctest from isctest.hypothesis.strategies import dns_names, uint -from hypothesis import assume, example, given -from hypothesis.strategies import binary, booleans, composite, just, sampled_from +import isctest pytestmark = pytest.mark.extra_artifacts( [ diff --git a/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py b/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py index 7e960ba6e1..01e86e0fa9 100755 --- a/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py +++ b/bin/tests/system/tsiggss/tests_isc_spnego_flaws.py @@ -20,10 +20,6 @@ import argparse import struct import time -import pytest - -import isctest - import dns import dns.message import dns.name @@ -31,6 +27,9 @@ import dns.rdata import dns.rdataclass import dns.rdatatype import dns.rrset +import pytest + +import isctest pytestmark = pytest.mark.extra_artifacts( [ diff --git a/bin/tests/system/verify/tests_verify.py b/bin/tests/system/verify/tests_verify.py index e5e780a532..2fe4d30b2f 100644 --- a/bin/tests/system/verify/tests_verify.py +++ b/bin/tests/system/verify/tests_verify.py @@ -9,9 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +from re import compile as Re + import os import re -from re import compile as Re import pytest diff --git a/bin/tests/system/wildcard/tests_wildcard.py b/bin/tests/system/wildcard/tests_wildcard.py index 60d75384f0..dfe0dc8314 100755 --- a/bin/tests/system/wildcard/tests_wildcard.py +++ b/bin/tests/system/wildcard/tests_wildcard.py @@ -31,7 +31,7 @@ Limitations - untested properties: # https://github.com/pylint-dev/pylint/issues/10785#issuecomment-3677224217 # pylint: disable=unreachable -import pytest +from hypothesis import assume, example, given, settings import dns import dns.message @@ -41,9 +41,9 @@ import dns.rcode import dns.rdataclass import dns.rdatatype import dns.rrset +import pytest from isctest.hypothesis.strategies import dns_names, dns_rdatatypes_without_meta -from hypothesis import assume, example, given, settings import isctest.check import isctest.name diff --git a/bin/tests/system/xfer/ans10/ans.py b/bin/tests/system/xfer/ans10/ans.py index 6f5346ff86..d162070c76 100644 --- a/bin/tests/system/xfer/ans10/ans.py +++ b/bin/tests/system/xfer/ans10/ans.py @@ -9,10 +9,7 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -from isctest.asyncserver import ( - AsyncDnsServer, - IgnoreAllQueries, -) +from isctest.asyncserver import AsyncDnsServer, IgnoreAllQueries def main() -> None: diff --git a/bin/tests/system/xfer/ans9/ans.py b/bin/tests/system/xfer/ans9/ans.py index 2e3a1f8be2..269afafe22 100644 --- a/bin/tests/system/xfer/ans9/ans.py +++ b/bin/tests/system/xfer/ans9/ans.py @@ -19,10 +19,10 @@ import dns.rrset from isctest.asyncserver import ( ControllableAsyncDnsServer, + DnsResponseSend, DomainHandler, QueryContext, ResponseAction, - DnsResponseSend, ToggleResponsesCommand, ) diff --git a/bin/tests/system/xfer/tests_xfer.py b/bin/tests/system/xfer/tests_xfer.py index 591e2ffab0..4f4aa058e2 100644 --- a/bin/tests/system/xfer/tests_xfer.py +++ b/bin/tests/system/xfer/tests_xfer.py @@ -10,18 +10,19 @@ # information regarding copyright ownership. +from re import compile as Re + import fileinput import os -from re import compile as Re import socket import time +import dns.message import pytest -import isctest from isctest.util import param -import dns.message +import isctest NEW_SOA_SERIAL = 1397051953 OLD_SOA_SERIAL = 1397051952 diff --git a/bin/tests/system/xferquota/tests_xferquota.py b/bin/tests/system/xferquota/tests_xferquota.py index a0d042d135..ba599471d5 100644 --- a/bin/tests/system/xferquota/tests_xferquota.py +++ b/bin/tests/system/xferquota/tests_xferquota.py @@ -9,10 +9,11 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. +from re import compile as Re + import glob import os import re -from re import compile as Re import shutil import signal import time diff --git a/bin/tests/system/zero/ans5/ans.py b/bin/tests/system/zero/ans5/ans.py index a7f63913cf..ad4a4e3ffd 100644 --- a/bin/tests/system/zero/ans5/ans.py +++ b/bin/tests/system/zero/ans5/ans.py @@ -11,9 +11,10 @@ See the COPYRIGHT file distributed with this work for additional information regarding copyright ownership. """ -import ipaddress from typing import AsyncGenerator +import ipaddress + import dns.rcode import dns.rdatatype import dns.rrset diff --git a/doc/arm/_ext/iscconf.py b/doc/arm/_ext/iscconf.py index 06ade14269..0fe566a548 100644 --- a/doc/arm/_ext/iscconf.py +++ b/doc/arm/_ext/iscconf.py @@ -23,9 +23,8 @@ https://www.sphinx-doc.org/en/master/development/tutorials/recipe.html from collections import namedtuple -from docutils.parsers.rst import Directive, directives from docutils import nodes - +from docutils.parsers.rst import Directive, directives from sphinx import addnodes from sphinx.directives import ObjectDescription from sphinx.domains import Domain diff --git a/doc/arm/_ext/mergegrammar.py b/doc/arm/_ext/mergegrammar.py index b0500eb4b5..b18e1e1626 100644 --- a/doc/arm/_ext/mergegrammar.py +++ b/doc/arm/_ext/mergegrammar.py @@ -13,9 +13,10 @@ # Depends on CWD - Sphinx plugin -import json from pathlib import Path +import json + import parsegrammar diff --git a/doc/misc/checkgrammar.py b/doc/misc/checkgrammar.py index 09984eceb4..f08c1e43dd 100644 --- a/doc/misc/checkgrammar.py +++ b/doc/misc/checkgrammar.py @@ -20,6 +20,7 @@ vs. '( unlimited | ) used in options. from collections import namedtuple from itertools import groupby + import fileinput import parsegrammar diff --git a/pyproject.toml b/pyproject.toml index 9946ac8df8..bb87900d7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,6 +90,8 @@ ignore_names = [ [tool.ruff] target-version = "py310" lint.select = [ + # import order + "I", # f-strings "UP031", "UP032", @@ -101,3 +103,12 @@ extend-exclude = [ "doc/arm/conf.py", "doc/man/conf.py", ] +src = [ + "bin/tests/system", + "doc/misc", + "doc/arm/_ext", +] +[tool.ruff.lint.isort] +from-first = true +lines-between-types = 1 +split-on-trailing-comma = false