]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use pytest.mark.flaky as the flaky marker
authorNicki Křížek <nicki@isc.org>
Thu, 3 Jul 2025 13:22:23 +0000 (15:22 +0200)
committerNicki Křížek <nicki@isc.org>
Mon, 7 Jul 2025 11:29:15 +0000 (13:29 +0200)
It's possible to use pytest.mark.flaky, which achieves the exact same
thing as our custom-defined isctest.mark.flaky -- attempts to rerun the
test on failure, but only is flaky package is available.

14 files changed:
bin/tests/system/autosign/tests_sh_autosign.py
bin/tests/system/dnstap/tests_sh_dnstap.py
bin/tests/system/enginepkcs11/tests_sh_enginepkcs11.py
bin/tests/system/fetchlimit/tests_sh_fetchlimit.py
bin/tests/system/isctest/mark.py
bin/tests/system/mkeys/tests_sh_mkeys.py
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/serve-stale/tests_sh_serve_stale.py
bin/tests/system/statschannel/tests_json.py
bin/tests/system/statschannel/tests_xml.py
bin/tests/system/timeouts/tests_tcp_timeouts.py

index b373e03b6a9eb0bc94a61133175e59337a3d6fe5..ef11cbe21a4106e804ed77e53f0b31b2761044a1 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-import isctest.mark
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "active.key",
@@ -151,6 +149,6 @@ pytestmark = pytest.mark.extra_artifacts(
 )
 
 
-@isctest.mark.flaky(max_runs=2)
+@pytest.mark.flaky(max_runs=2)
 def test_autosign(run_tests_sh):
     run_tests_sh()
index e487ca2d089790103a627423adfd24f693f844ad..8fef97a47e7806c840c886b275dc585047971c75 100644 (file)
@@ -31,6 +31,6 @@ pytestmark = [
 ]
 
 
-@isctest.mark.flaky(max_runs=2, rerun_filter=isctest.mark.is_host_freebsd_13)
+@pytest.mark.flaky(max_runs=2, rerun_filter=isctest.mark.is_host_freebsd_13)
 def test_dnstap(run_tests_sh):
     run_tests_sh()
index 7a5ed394e6e024baeaf7bcd76003c208d65dc0b3..089ac7ea604ab6f44b963d0c5c0818aa7133b87e 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-import isctest.mark
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
@@ -51,6 +49,6 @@ pytestmark = pytest.mark.extra_artifacts(
 )
 
 
-@isctest.mark.flaky(max_runs=5)  # GL#4605
+@pytest.mark.flaky(max_runs=5)  # GL#4605
 def test_enginepkcs11(run_tests_sh):
     run_tests_sh()
index 2732296fc2c541f677393c1bf7bddf52d726783e..23076980b5d7a9acb9134d497204e4ea624b0183 100644 (file)
@@ -22,9 +22,7 @@ pytestmark = pytest.mark.extra_artifacts(
     ]
 )
 
-import isctest.mark
 
-
-@isctest.mark.flaky(max_runs=3)
+@pytest.mark.flaky(max_runs=3)
 def test_fetchlimit(run_tests_sh):
     run_tests_sh()
index 199cc92e424fd76e9c7b8331bd36d53895a388d5..7fdb964dc69f72fc8fab595bce67509618ff3321 100644 (file)
@@ -80,20 +80,3 @@ softhsm2_environment = pytest.mark.skipif(
     ),
     reason="SOFTHSM2_CONF and SOFTHSM2_MODULE environmental variables must be set and pkcs11-tool and softhsm2-util tools present",
 )
-
-try:
-    import flaky as flaky_pkg  # type: ignore
-except ModuleNotFoundError:
-    # In case the flaky package is not installed, run the tests as usual
-    # without any attempts to re-run them.
-    # pylint: disable=unused-argument
-    def flaky(*args, **kwargs):
-        """Mock decorator that doesn't do anything special, just returns the function."""
-
-        def wrapper(wrapped_obj):
-            return wrapped_obj
-
-        return wrapper
-
-else:
-    flaky = flaky_pkg.flaky
index a98c98ffaf29437301bcee97012729f2c5584dd9..3bf2549500ea1f151935273f8f12582e93a0a0b4 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-import isctest.mark
-
 pytestmark = [
     pytest.mark.algorithm_set("ecc_default"),
     pytest.mark.extra_artifacts(
@@ -52,6 +50,6 @@ pytestmark = [
 ]
 
 
-@isctest.mark.flaky(max_runs=2)  # GL#3098
+@pytest.mark.flaky(max_runs=2)  # GL#3098
 def test_mkeys(run_tests_sh):
     run_tests_sh()
index 735b6a78e3da90db0970710049b5fda3a54aef0c..2159a6a7dc92d2e30635bbbe01df5f5f237a7da1 100644 (file)
@@ -13,8 +13,6 @@ import platform
 
 import pytest
 
-import isctest.mark
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "Kxxx*",
@@ -82,6 +80,6 @@ pytestmark = pytest.mark.extra_artifacts(
 MAX_RUNS = 2 if platform.system() == "FreeBSD" else 1  # GL#3846
 
 
-@isctest.mark.flaky(max_runs=MAX_RUNS)
+@pytest.mark.flaky(max_runs=MAX_RUNS)
 def test_nsupdate(run_tests_sh):
     run_tests_sh()
index 2d9f90b4dba5186341e03ffff55b633735835726..1116f7ec6ce0ca50603ded14ffd33ae66ed8aebd 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-import isctest.mark
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
@@ -25,6 +23,6 @@ pytestmark = pytest.mark.extra_artifacts(
 
 
 # The qmin test is inherently unstable, see GL #904 for details.
-@isctest.mark.flaky(max_runs=3)
+@pytest.mark.flaky(max_runs=3)
 def test_qmin(run_tests_sh):
     run_tests_sh()
index 6a0ab3155698bc1aea2b58eddf4b6dfe12f7d219..d22d10a523809f2ed4df1961ad47df6262318b5e 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-import isctest.mark
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
@@ -27,6 +25,6 @@ pytestmark = pytest.mark.extra_artifacts(
 
 
 # The reclimit is known to be quite unstable. GL #1587
-@isctest.mark.flaky(max_runs=2)
+@pytest.mark.flaky(max_runs=2)
 def test_reclimit(run_tests_sh):
     run_tests_sh()
index 99be723c93fcc8ca210827b414b42907d6e85aa0..12ce0ca29f4f61245f28a25e83ee54bc48a4861b 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-import isctest.mark
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "*mdig.out*",
@@ -24,6 +22,6 @@ pytestmark = pytest.mark.extra_artifacts(
 
 
 # The rrl is known to be quite unstable. GL #172
-@isctest.mark.flaky(max_runs=2)
+@pytest.mark.flaky(max_runs=2)
 def test_rrl(run_tests_sh):
     run_tests_sh()
index ac3ab100cc158ad8c06ecd6ae8eeff6870c4553f..1f96485cd2e9540d673d39fc914a821b30b70561 100644 (file)
@@ -11,8 +11,6 @@
 
 import pytest
 
-import isctest.mark
-
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
@@ -28,6 +26,6 @@ pytestmark = pytest.mark.extra_artifacts(
 )
 
 
-@isctest.mark.flaky(max_runs=2)
+@pytest.mark.flaky(max_runs=2)
 def test_serve_stale(run_tests_sh):
     run_tests_sh()
index 4b650b3145c456823cf62aa6e7b131e95ddc1ede..21f240224392a42ed1ab2b30e374109428727b93 100755 (executable)
@@ -119,6 +119,6 @@ def test_zone_with_many_keys_json(statsport):
     )
 
 
-@isctest.mark.flaky(max_runs=2)
+@pytest.mark.flaky(max_runs=2)
 def test_traffic_json(statsport):
     generic.test_traffic(fetch_traffic_json, statsip="10.53.0.2", statsport=statsport)
index 22e03871a684c050bdafb08de6c67e66b110fac1..796eea9d2446292ddc15fc6b887b8637fe089a76 100755 (executable)
@@ -148,6 +148,6 @@ def test_zone_with_many_keys_xml(statsport):
     )
 
 
-@isctest.mark.flaky(max_runs=2)
+@pytest.mark.flaky(max_runs=2)
 def test_traffic_xml(statsport):
     generic.test_traffic(fetch_traffic_xml, statsip="10.53.0.2", statsport=statsport)
index 1fe1088a695ae93edc820143f77940e09de25b99..cb8defa71effd129710d958e52991af3a70f2560 100644 (file)
@@ -67,7 +67,7 @@ def test_initial_timeout(named_port):
                 raise EOFError from e
 
 
-@isctest.mark.flaky(max_runs=2, rerun_filter=isctest.mark.is_host_freebsd_13)
+@pytest.mark.flaky(max_runs=2, rerun_filter=isctest.mark.is_host_freebsd_13)
 def test_idle_timeout(named_port):
     #
     # The idle timeout is 5 seconds, so the third message should fail
@@ -189,7 +189,7 @@ def test_long_axfr(named_port):
         assert soa is not None
 
 
-@isctest.mark.flaky(max_runs=3)
+@pytest.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))