mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-27 12:13:20 -04:00
Move custom pytest markers into isctest module
Keep our pytest code more organized by moving the shared code for custom
pytest markers into a dedicated isctest/mark.py module.
(cherry picked from commit f314f1b432)
This commit is contained in:
parent
17efc13cab
commit
af12ce03f3
10 changed files with 23 additions and 18 deletions
|
|
@ -14,3 +14,8 @@ from . import instance
|
|||
from . import query
|
||||
from . import rndc
|
||||
from . import log
|
||||
|
||||
# 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
|
||||
# `isctest` package. To use the marks, manual `import isctest.mark` is needed
|
||||
# instead.
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@
|
|||
|
||||
import platform
|
||||
|
||||
import pytest_custom_markers
|
||||
import isctest.mark
|
||||
|
||||
|
||||
MAX_RUNS = 2 if platform.system() == "FreeBSD" else 1 # GL#3846
|
||||
|
||||
|
||||
@pytest_custom_markers.flaky(max_runs=MAX_RUNS)
|
||||
@isctest.mark.flaky(max_runs=MAX_RUNS)
|
||||
def test_nsupdate(run_tests_sh):
|
||||
run_tests_sh()
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
import pytest_custom_markers
|
||||
import isctest.mark
|
||||
|
||||
|
||||
# The qmin test is inherently unstable, see GL #904 for details.
|
||||
@pytest_custom_markers.flaky(max_runs=3)
|
||||
@isctest.mark.flaky(max_runs=3)
|
||||
def test_qmin(run_tests_sh):
|
||||
run_tests_sh()
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
import pytest_custom_markers
|
||||
import isctest.mark
|
||||
|
||||
|
||||
# The reclimit is known to be quite unstable. GL #1587
|
||||
@pytest_custom_markers.flaky(max_runs=2)
|
||||
@isctest.mark.flaky(max_runs=2)
|
||||
def test_reclimit(run_tests_sh):
|
||||
run_tests_sh()
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
import pytest_custom_markers
|
||||
import isctest.mark
|
||||
|
||||
|
||||
# The rrl is known to be quite unstable. GL #172
|
||||
@pytest_custom_markers.flaky(max_runs=2)
|
||||
@isctest.mark.flaky(max_runs=2)
|
||||
def test_rrl(run_tests_sh):
|
||||
run_tests_sh()
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
import pytest_custom_markers
|
||||
import isctest.mark
|
||||
|
||||
|
||||
@pytest_custom_markers.flaky(max_runs=2) # GL#1621
|
||||
@isctest.mark.flaky(max_runs=2) # GL#1621
|
||||
def test_statistics(run_tests_sh):
|
||||
run_tests_sh()
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ from datetime import datetime
|
|||
|
||||
import pytest
|
||||
|
||||
import pytest_custom_markers
|
||||
import isctest.mark
|
||||
|
||||
pytest.register_assert_rewrite("generic")
|
||||
import generic
|
||||
|
||||
pytestmark = pytest_custom_markers.have_json_c
|
||||
pytestmark = isctest.mark.have_json_c
|
||||
requests = pytest.importorskip("requests")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ import xml.etree.ElementTree as ET
|
|||
|
||||
import pytest
|
||||
|
||||
import pytest_custom_markers
|
||||
import isctest.mark
|
||||
|
||||
pytest.register_assert_rewrite("generic")
|
||||
import generic
|
||||
|
||||
pytestmark = pytest_custom_markers.have_libxml2
|
||||
pytestmark = isctest.mark.have_libxml2
|
||||
requests = pytest.importorskip("requests")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import dns.query
|
|||
import dns.rdataclass
|
||||
import dns.rdatatype
|
||||
|
||||
import pytest_custom_markers # pylint: disable=import-error
|
||||
import isctest.mark # pylint: disable=import-error
|
||||
|
||||
|
||||
TIMEOUT = 10
|
||||
|
|
@ -185,7 +185,7 @@ def test_long_axfr(named_port):
|
|||
assert soa is not None
|
||||
|
||||
|
||||
@pytest_custom_markers.flaky(max_runs=3)
|
||||
@isctest.mark.flaky(max_runs=3)
|
||||
def test_send_timeout(named_port):
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||
sock.connect(("10.53.0.1", named_port))
|
||||
|
|
@ -212,7 +212,7 @@ def test_send_timeout(named_port):
|
|||
raise EOFError from e
|
||||
|
||||
|
||||
@pytest_custom_markers.long_test
|
||||
@isctest.mark.long_test
|
||||
def test_max_transfer_idle_out(named_port):
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||
sock.connect(("10.53.0.1", named_port))
|
||||
|
|
@ -246,7 +246,7 @@ def test_max_transfer_idle_out(named_port):
|
|||
assert soa is None
|
||||
|
||||
|
||||
@pytest_custom_markers.long_test
|
||||
@isctest.mark.long_test
|
||||
def test_max_transfer_time_out(named_port):
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||
sock.connect(("10.53.0.1", named_port))
|
||||
|
|
|
|||
Loading…
Reference in a new issue