+++ /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.
-
-import pytest
-
-
-def pytest_configure(config):
- config.addinivalue_line(
- "markers", "dnspython: mark tests that need dnspython to function"
- )
- config.addinivalue_line(
- "markers", "dnspython2: mark tests that need dnspython >= 2.0.0"
- )
-
-
-def pytest_collection_modifyitems(config, items):
- # pylint: disable=unused-argument,unused-import,too-many-branches
- # pylint: disable=import-outside-toplevel
-
- # Test for dnspython module
- skip_dnspython = pytest.mark.skip(
- reason="need dnspython module to run")
- try:
- import dns.query # noqa: F401
- except ModuleNotFoundError:
- for item in items:
- if "dnspython" in item.keywords:
- item.add_marker(skip_dnspython)
-
- # Test for dnspython >= 2.0.0 module
- skip_dnspython2 = pytest.mark.skip(
- reason="need dnspython >= 2.0.0 module to run")
- try:
- from dns.query import udp_with_fallback # noqa: F401
- except ImportError:
- for item in items:
- if "dnspython2" in item.keywords:
- item.add_marker(skip_dnspython2)
import dns.resolver
import pytest
+pytest.importorskip('dns', minversion='2.0.0')
+
def has_signed_apex_nsec(zone, response):
has_nsec = False
assert found
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_checkds_dspublished(named_port):
# We create resolver instances that will be used to send queries.
server = dns.resolver.Resolver()
# TBD: Check with TLS
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_checkds_dswithdrawn(named_port):
# We create resolver instances that will be used to send queries.
server = dns.resolver.Resolver()
+++ /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.
-
-import pytest
-
-try:
- import dns.resolver # noqa: F401 # pylint: disable=unused-import
-except ModuleNotFoundError:
- dns_resolver_module_found = False
-else:
- dns_resolver_module_found = True
-
-
-def pytest_configure(config):
- config.addinivalue_line(
- "markers", "dnspython: mark tests that need dnspython to function"
- )
-
-
-def pytest_collection_modifyitems(config, items):
- # pylint: disable=unused-argument
- # Test for dnspython module
- if not dns_resolver_module_found:
- skip_requests = pytest.mark.skip(reason="need dnspython module to run")
- for item in items:
- if "dnspython" in item.keywords:
- item.add_marker(skip_requests)
# information regarding copyright ownership.
import os
+
import pytest
+
+pytest.importorskip('dns')
import dns.resolver
-# @pytest.mark.dnspython
def test_rpz_passthru_logging(named_port):
resolver = dns.resolver.Resolver()
resolver.nameservers = ['10.53.0.1']
+++ /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.
-
-import pytest
-
-
-def pytest_configure(config):
- config.addinivalue_line(
- "markers", "dnspython: mark tests that need dnspython to function"
- )
-
-
-def pytest_collection_modifyitems(config, items):
- # pylint: disable=unused-argument,unused-import,too-many-branches
- # pylint: disable=import-outside-toplevel
-
- # Test for dnspython module
- skip_dnspython = pytest.mark.skip(
- reason="need dnspython module to run")
- try:
- import dns.query # noqa: F401
- except ModuleNotFoundError:
- for item in items:
- if "dnspython" in item.keywords:
- item.add_marker(skip_dnspython)
import dns.resolver
import pytest
+pytest.importorskip('dns')
+
def do_work(named_proc, resolver, rndc_cmd, kill_method, n_workers, n_queries):
"""Creates a number of A queries to run in parallel
assert ret_code == 0
-@pytest.mark.dnspython
def test_named_shutdown(named_port, control_port):
# pylint: disable-msg=too-many-locals
cfg_dir = os.path.join(os.getcwd(), "resolver")
+++ /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.
-
-import pytest
-
-
-def pytest_configure(config):
- config.addinivalue_line(
- "markers", "dnspython: mark tests that need dnspython to function"
- )
- config.addinivalue_line(
- "markers", "dnspython2: mark tests that need dnspython >= 2.0.0"
- )
-
-
-def pytest_collection_modifyitems(config, items):
- # pylint: disable=unused-argument,unused-import,too-many-branches
- # pylint: disable=import-outside-toplevel
-
- # Test for dnspython module
- skip_dnspython = pytest.mark.skip(
- reason="need dnspython module to run")
- try:
- import dns.query # noqa: F401
- except ModuleNotFoundError:
- for item in items:
- if "dnspython" in item.keywords:
- item.add_marker(skip_dnspython)
-
- # Test for dnspython >= 2.0.0 module
- skip_dnspython2 = pytest.mark.skip(
- reason="need dnspython >= 2.0.0 module to run")
- try:
- from dns.query import send_tcp # noqa: F401
- except ImportError:
- for item in items:
- if "dnspython2" in item.keywords:
- item.add_marker(skip_dnspython2)
import pytest
+pytest.importorskip('dns', minversion='2.0.0')
+
+
TIMEOUT = 10
return sock
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_tcp_garbage(named_port):
import dns.query
raise EOFError from e
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_tcp_garbage_response(named_port):
import dns.query
import dns.message
def pytest_configure(config):
- config.addinivalue_line(
- "markers", "dnspython: mark tests that need dnspython to function"
- )
- config.addinivalue_line(
- "markers", "dnspython2: mark tests that need dnspython >= 2.0.0"
- )
config.addinivalue_line(
"markers", "long: mark tests that take a long time to run"
)
def pytest_collection_modifyitems(config, items):
# pylint: disable=unused-argument,unused-import,too-many-branches
# pylint: disable=import-outside-toplevel
-
- # Test for dnspython module
- skip_dnspython = pytest.mark.skip(
- reason="need dnspython module to run")
- try:
- import dns.query # noqa: F401
- except ModuleNotFoundError:
- for item in items:
- if "dnspython" in item.keywords:
- item.add_marker(skip_dnspython)
-
- # Test for dnspython >= 2.0.0 module
- skip_dnspython2 = pytest.mark.skip(
- reason="need dnspython >= 2.0.0 module to run")
- try:
- from dns.query import send_tcp # noqa: F401
- except ImportError:
- for item in items:
- if "dnspython2" in item.keywords:
- item.add_marker(skip_dnspython2)
-
skip_long_tests = pytest.mark.skip(
reason="need CI_ENABLE_ALL_TESTS environment variable")
if not os.environ.get("CI_ENABLE_ALL_TESTS"):
import pytest
+pytest.importorskip('dns', minversion='2.0.0')
+
+
TIMEOUT = 10
return time.time() + TIMEOUT
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_initial_timeout(named_port):
#
# The initial timeout is 2.5 seconds, so this should timeout
raise EOFError from e
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_idle_timeout(named_port):
#
# The idle timeout is 5 seconds, so the third message should fail
raise EOFError from e
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_keepalive_timeout(named_port):
#
# Keepalive is 7 seconds, so the third message should succeed.
(response, rtime) = dns.query.receive_tcp(sock, timeout())
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_pipelining_timeout(named_port):
#
# The pipelining should only timeout after the last message is received
raise EOFError from e
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_long_axfr(named_port):
#
# The timers should not fire during AXFR, thus the connection should not
assert soa is not None
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
def test_send_timeout(named_port):
import dns.query
raise EOFError from e
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
@pytest.mark.long
def test_max_transfer_idle_out(named_port):
import dns.query
assert soa is None
-@pytest.mark.dnspython
-@pytest.mark.dnspython2
@pytest.mark.long
def test_max_transfer_time_out(named_port):
import dns.query