]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Move custom pytest markers into isctest module
authorTom Krizek <tkrizek@isc.org>
Fri, 22 Dec 2023 14:56:58 +0000 (15:56 +0100)
committerTom Krizek <tkrizek@isc.org>
Wed, 10 Jan 2024 13:57:13 +0000 (14:57 +0100)
Keep our pytest code more organized by moving the shared code for custom
pytest markers into a dedicated isctest/mark.py module.

bin/tests/system/isctest/__init__.py
bin/tests/system/isctest/mark.py [moved from bin/tests/system/pytest_custom_markers.py with 100% similarity]
bin/tests/system/nsupdate/tests_sh_nsupdate.py
bin/tests/system/qmin/tests_sh_qmin.py
bin/tests/system/reclimit/tests_sh_reclimit.py
bin/tests/system/rrl/tests_sh_rrl.py
bin/tests/system/statschannel/tests_json.py
bin/tests/system/statschannel/tests_xml.py
bin/tests/system/timeouts/tests_tcp_timeouts.py

index 3ea82a3f455c0bd75f2211f3208a17682fe75720..047ca7762ab95c00eb844cf2565e2ab8f35c3ea5 100644 (file)
@@ -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.
index 5c1a9c7e3de4504798bdf99afcc157e4e5887a1e..305f1a191f48fbc4508bd3bb1856a2cfdc5095f9 100644 (file)
 
 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()
index 607732232e28a73289e84e09950c1f6d87113295..0faeebd0e92aeb7d26935face6e1ac5efb551ded 100644 (file)
@@ -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()
index 4710027581e729db97360b95d34609e365063170..447c9488e0befd716da980bd66f26a030b4d602b 100644 (file)
@@ -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()
index 05b43a6fe1889387b25b28698db685f744186335..c32305b5d71aea56e4aea0d9d6f942a533570d39 100644 (file)
@@ -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()
index 4f7c4a7d7cd96228b9e935bf9b2f471750eaf0a9..9b525418473868a153a86d579e34a0b7f30a4368 100755 (executable)
@@ -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")
 
 
index 53296155da5044b91f4014798264637de4bc94eb..81ac187587b0a9f607703d5340243c2716fc61a5 100755 (executable)
@@ -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")
 
 
index 2e2a4b47e26c7081795a212fda900759ee7d64b2..f6153405102de1759a56f3c3cb1ff155011f695a 100644 (file)
@@ -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))