From: Štěpán Balážik Date: Tue, 27 Jan 2026 23:01:35 +0000 (+0100) Subject: Fix 'Import should be placed at the top of the module' X-Git-Tag: v9.20.20~5^2~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7dd6b4dc5bbdd3276adb2d7f39addd385f75862c;p=thirdparty%2Fbind9.git Fix 'Import should be placed at the top of the module' In preparation for running pylint on more Python code. (cherry picked from commit 4253d7298c3ba0c4bbd20194bff7d0d4832409c1) --- diff --git a/bin/tests/system/ans.py b/bin/tests/system/ans.py index 9dbdee11c1d..6ac5498d1db 100644 --- a/bin/tests/system/ans.py +++ b/bin/tests/system/ans.py @@ -9,9 +9,7 @@ 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. -""" -""" This is a bare-bones DNS server that only serves data from zone files. It is meant to be used as a replacement for full-blown named instances in system tests when a given server is only required to return zone-based data. diff --git a/bin/tests/system/conftest.py b/bin/tests/system/conftest.py index 49126d9788a..c00161d39da 100644 --- a/bin/tests/system/conftest.py +++ b/bin/tests/system/conftest.py @@ -23,9 +23,12 @@ import pytest pytest.register_assert_rewrite("isctest") +# pylint: disable=wrong-import-position import isctest from isctest.vars.dirs import SYSTEM_TEST_DIR_GIT_PATH +# pylint: enable=wrong-import-position + # Silence warnings caused by passing a pytest fixture to another fixture. # pylint: disable=redefined-outer-name 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 d66644ce7b2..2e6c667d22c 100644 --- a/bin/tests/system/dnssec-malformed-dnskey/tests_malformed_dnskey.py +++ b/bin/tests/system/dnssec-malformed-dnskey/tests_malformed_dnskey.py @@ -15,8 +15,6 @@ from re import compile as Re import os import pytest -pytest.importorskip("cryptography") - from cryptography.hazmat.primitives.asymmetric import ec import dns diff --git a/bin/tests/system/ixfr/ans2/ans.py b/bin/tests/system/ixfr/ans2/ans.py index 86592444264..37b22917216 100644 --- a/bin/tests/system/ixfr/ans2/ans.py +++ b/bin/tests/system/ixfr/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,