From 678fe818516906dbbd672cc01503b1cb27e12254 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Tue, 9 Dec 2025 14:36:57 +0100 Subject: [PATCH] pytest: use classmethod instead of class property Some python version seem to have problems with that. --- test/modules/http2/env.py | 1 - test/modules/http2/test_001_httpd_alive.py | 2 +- test/modules/http2/test_002_curl_basics.py | 2 +- test/modules/http2/test_003_get.py | 2 +- test/modules/http2/test_004_post.py | 2 +- test/modules/http2/test_005_files.py | 2 +- test/modules/http2/test_006_assets.py | 2 +- test/modules/http2/test_007_ssi.py | 2 +- test/modules/http2/test_008_ranges.py | 2 +- test/modules/http2/test_009_timing.py | 2 +- test/modules/http2/test_100_conn_reuse.py | 2 +- test/modules/http2/test_101_ssl_reneg.py | 2 +- test/modules/http2/test_102_require.py | 2 +- test/modules/http2/test_103_upgrade.py | 2 +- test/modules/http2/test_104_padding.py | 2 +- test/modules/http2/test_106_shutdown.py | 2 +- test/modules/http2/test_107_frame_lengths.py | 2 +- test/modules/http2/test_200_header_invalid.py | 2 +- test/modules/http2/test_201_header_conditional.py | 2 +- test/modules/http2/test_300_interim.py | 2 +- test/modules/http2/test_400_push.py | 2 +- test/modules/http2/test_401_early_hints.py | 2 +- test/modules/http2/test_500_proxy.py | 2 +- test/modules/http2/test_501_proxy_serverheader.py | 2 +- test/modules/http2/test_502_proxy_port.py | 2 +- test/modules/http2/test_503_proxy_fwd.py | 2 +- test/modules/http2/test_600_h2proxy.py | 2 +- test/modules/http2/test_601_h2proxy_twisted.py | 2 +- test/modules/http2/test_700_load_get.py | 2 +- test/modules/http2/test_710_load_post_static.py | 2 +- test/modules/http2/test_711_load_post_cgi.py | 2 +- test/modules/http2/test_712_buffering.py | 2 +- test/modules/http2/test_800_websockets.py | 2 +- 33 files changed, 32 insertions(+), 33 deletions(-) diff --git a/test/modules/http2/env.py b/test/modules/http2/env.py index 0c4b9884..8910cb16 100644 --- a/test/modules/http2/env.py +++ b/test/modules/http2/env.py @@ -66,7 +66,6 @@ def _setup_data_1k_1m(self): class H2TestEnv(HttpdTestEnv): @classmethod - @property def is_unsupported(cls): mpm_module = f"mpm_{os.environ['MPM']}" if 'MPM' in os.environ else 'mpm_event' return mpm_module == 'mpm_prefork' diff --git a/test/modules/http2/test_001_httpd_alive.py b/test/modules/http2/test_001_httpd_alive.py index b5708d28..d8126959 100644 --- a/test/modules/http2/test_001_httpd_alive.py +++ b/test/modules/http2/test_001_httpd_alive.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestBasicAlive: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_002_curl_basics.py b/test/modules/http2/test_002_curl_basics.py index 91be7721..2c8886dd 100644 --- a/test/modules/http2/test_002_curl_basics.py +++ b/test/modules/http2/test_002_curl_basics.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestCurlBasics: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_003_get.py b/test/modules/http2/test_003_get.py index b288848d..e71a86de 100644 --- a/test/modules/http2/test_003_get.py +++ b/test/modules/http2/test_003_get.py @@ -6,7 +6,7 @@ log = logging.getLogger(__name__) -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestGet: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_004_post.py b/test/modules/http2/test_004_post.py index 295f989b..3edb218e 100644 --- a/test/modules/http2/test_004_post.py +++ b/test/modules/http2/test_004_post.py @@ -12,7 +12,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestPost: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_005_files.py b/test/modules/http2/test_005_files.py index e7618362..40abbf65 100644 --- a/test/modules/http2/test_005_files.py +++ b/test/modules/http2/test_005_files.py @@ -15,7 +15,7 @@ def mk_text_file(fpath: str, lines: int): fd.write("\n") -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestFiles: URI_PATHS = [] diff --git a/test/modules/http2/test_006_assets.py b/test/modules/http2/test_006_assets.py index 778314ed..d02e8dc4 100644 --- a/test/modules/http2/test_006_assets.py +++ b/test/modules/http2/test_006_assets.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestAssets: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_007_ssi.py b/test/modules/http2/test_007_ssi.py index f5411bcc..1da48ff4 100644 --- a/test/modules/http2/test_007_ssi.py +++ b/test/modules/http2/test_007_ssi.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestSSI: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_008_ranges.py b/test/modules/http2/test_008_ranges.py index dd695bb0..53664e1d 100644 --- a/test/modules/http2/test_008_ranges.py +++ b/test/modules/http2/test_008_ranges.py @@ -11,7 +11,7 @@ log = logging.getLogger(__name__) -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestRanges: LOGFILE = "" diff --git a/test/modules/http2/test_009_timing.py b/test/modules/http2/test_009_timing.py index 2784f9ad..94895cc3 100644 --- a/test/modules/http2/test_009_timing.py +++ b/test/modules/http2/test_009_timing.py @@ -6,7 +6,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") @pytest.mark.skipif(not H2TestEnv().h2load_is_at_least('1.41.0'), reason="h2load misses --connect-to option") class TestTiming: diff --git a/test/modules/http2/test_100_conn_reuse.py b/test/modules/http2/test_100_conn_reuse.py index 103166fa..ed958eb2 100644 --- a/test/modules/http2/test_100_conn_reuse.py +++ b/test/modules/http2/test_100_conn_reuse.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestConnReuse: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_101_ssl_reneg.py b/test/modules/http2/test_101_ssl_reneg.py index d278af21..7bd10f55 100644 --- a/test/modules/http2/test_101_ssl_reneg.py +++ b/test/modules/http2/test_101_ssl_reneg.py @@ -4,7 +4,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") @pytest.mark.skipif(H2TestEnv.get_ssl_module() != "mod_ssl", reason="only for mod_ssl") class TestSslRenegotiation: diff --git a/test/modules/http2/test_102_require.py b/test/modules/http2/test_102_require.py index 4b0cad56..e97fb19c 100644 --- a/test/modules/http2/test_102_require.py +++ b/test/modules/http2/test_102_require.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestRequire: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_103_upgrade.py b/test/modules/http2/test_103_upgrade.py index 1542450d..b04aca42 100644 --- a/test/modules/http2/test_103_upgrade.py +++ b/test/modules/http2/test_103_upgrade.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestUpgrade: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_104_padding.py b/test/modules/http2/test_104_padding.py index 401804ad..35a5ba32 100644 --- a/test/modules/http2/test_104_padding.py +++ b/test/modules/http2/test_104_padding.py @@ -8,7 +8,7 @@ def frame_padding(payload, padbits): return ((payload + 9 + mask) & ~mask) - (payload + 9) -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestPadding: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_106_shutdown.py b/test/modules/http2/test_106_shutdown.py index 77de8441..962bd9e4 100644 --- a/test/modules/http2/test_106_shutdown.py +++ b/test/modules/http2/test_106_shutdown.py @@ -11,7 +11,7 @@ from pyhttpd.result import ExecResult -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestShutdown: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_107_frame_lengths.py b/test/modules/http2/test_107_frame_lengths.py index 93f769a7..3c272806 100644 --- a/test/modules/http2/test_107_frame_lengths.py +++ b/test/modules/http2/test_107_frame_lengths.py @@ -15,7 +15,7 @@ def mk_text_file(fpath: str, lines: int): fd.write("\n") -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestFrameLengths: URI_PATHS = [] diff --git a/test/modules/http2/test_200_header_invalid.py b/test/modules/http2/test_200_header_invalid.py index 5cd4e91c..9108eba0 100644 --- a/test/modules/http2/test_200_header_invalid.py +++ b/test/modules/http2/test_200_header_invalid.py @@ -7,7 +7,7 @@ log = logging.getLogger(__name__) -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestInvalidHeaders: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_201_header_conditional.py b/test/modules/http2/test_201_header_conditional.py index f1032683..a7dbe7a6 100644 --- a/test/modules/http2/test_201_header_conditional.py +++ b/test/modules/http2/test_201_header_conditional.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestConditionalHeaders: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_300_interim.py b/test/modules/http2/test_300_interim.py index 774ab88a..efe777a2 100644 --- a/test/modules/http2/test_300_interim.py +++ b/test/modules/http2/test_300_interim.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestInterimResponses: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_400_push.py b/test/modules/http2/test_400_push.py index 9c61608d..1cd2a6ad 100644 --- a/test/modules/http2/test_400_push.py +++ b/test/modules/http2/test_400_push.py @@ -5,7 +5,7 @@ # The push tests depend on "nghttp" -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestPush: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_401_early_hints.py b/test/modules/http2/test_401_early_hints.py index 57043052..4c1f61ba 100644 --- a/test/modules/http2/test_401_early_hints.py +++ b/test/modules/http2/test_401_early_hints.py @@ -4,7 +4,7 @@ # The push tests depend on "nghttp" -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestEarlyHints: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_500_proxy.py b/test/modules/http2/test_500_proxy.py index d1173420..2fd7ff91 100644 --- a/test/modules/http2/test_500_proxy.py +++ b/test/modules/http2/test_500_proxy.py @@ -6,7 +6,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestProxy: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_501_proxy_serverheader.py b/test/modules/http2/test_501_proxy_serverheader.py index 0d7c1889..fab22b90 100644 --- a/test/modules/http2/test_501_proxy_serverheader.py +++ b/test/modules/http2/test_501_proxy_serverheader.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestProxyServerHeader: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_502_proxy_port.py b/test/modules/http2/test_502_proxy_port.py index f6c6db15..3bbe7594 100644 --- a/test/modules/http2/test_502_proxy_port.py +++ b/test/modules/http2/test_502_proxy_port.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestProxyPort: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_503_proxy_fwd.py b/test/modules/http2/test_503_proxy_fwd.py index 478a52d0..e007325f 100644 --- a/test/modules/http2/test_503_proxy_fwd.py +++ b/test/modules/http2/test_503_proxy_fwd.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestProxyFwd: @classmethod diff --git a/test/modules/http2/test_600_h2proxy.py b/test/modules/http2/test_600_h2proxy.py index 2b9efd36..801c73fd 100644 --- a/test/modules/http2/test_600_h2proxy.py +++ b/test/modules/http2/test_600_h2proxy.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestH2Proxy: def test_h2_600_01(self, env): diff --git a/test/modules/http2/test_601_h2proxy_twisted.py b/test/modules/http2/test_601_h2proxy_twisted.py index 60f5f7df..52aaa09d 100644 --- a/test/modules/http2/test_601_h2proxy_twisted.py +++ b/test/modules/http2/test_601_h2proxy_twisted.py @@ -9,7 +9,7 @@ log = logging.getLogger(__name__) -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestH2ProxyTwisted: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_700_load_get.py b/test/modules/http2/test_700_load_get.py index 138e74ce..b5a6b73c 100644 --- a/test/modules/http2/test_700_load_get.py +++ b/test/modules/http2/test_700_load_get.py @@ -3,7 +3,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") @pytest.mark.skipif(not H2TestEnv().h2load_is_at_least('1.41.0'), reason="h2load misses --connect-to option") class TestLoadGet: diff --git a/test/modules/http2/test_710_load_post_static.py b/test/modules/http2/test_710_load_post_static.py index ad8ae96a..2eb606bf 100644 --- a/test/modules/http2/test_710_load_post_static.py +++ b/test/modules/http2/test_710_load_post_static.py @@ -4,7 +4,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestLoadPostStatic: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_711_load_post_cgi.py b/test/modules/http2/test_711_load_post_cgi.py index 82529d17..f2ff19b8 100644 --- a/test/modules/http2/test_711_load_post_cgi.py +++ b/test/modules/http2/test_711_load_post_cgi.py @@ -4,7 +4,7 @@ from .env import H2Conf, H2TestEnv -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestLoadCgi: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_712_buffering.py b/test/modules/http2/test_712_buffering.py index 0a6978b4..89053e35 100644 --- a/test/modules/http2/test_712_buffering.py +++ b/test/modules/http2/test_712_buffering.py @@ -6,7 +6,7 @@ from pyhttpd.curl import CurlPiper -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") class TestBuffering: @pytest.fixture(autouse=True, scope='class') diff --git a/test/modules/http2/test_800_websockets.py b/test/modules/http2/test_800_websockets.py index 5d4f74dd..49ecc0f2 100644 --- a/test/modules/http2/test_800_websockets.py +++ b/test/modules/http2/test_800_websockets.py @@ -84,7 +84,7 @@ def ws_run(env: H2TestEnv, path, authority=None, do_input=None, inbytes=None, stdout=b'', stderr=b'', duration=end - start), infos, frames -@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here") +@pytest.mark.skipif(condition=H2TestEnv.is_unsupported(), reason="mod_http2 not supported here") @pytest.mark.skipif(condition=not H2TestEnv().httpd_is_at_least("2.4.60"), reason=f'need at least httpd 2.4.60 for this') @pytest.mark.skipif(condition=ws_version < ws_version_min,