1
0
mirror of https://github.com/apache/httpd.git synced 2026-10-23 22:49:01 +03:00
Files
apache/test/conftest.py
Stefan Eissing 64f0f48309 Merge /httpd/httpd/trunk:r1933904
pytest compatibility with recent python versions fixes



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1933906 13f79535-47bb-0310-9956-ffa450edef68
2026-05-07 09:55:24 +00:00

32 lines
937 B
Python

import sys
import os
import pytest
sys.path.append(os.path.join(os.path.dirname(__file__), '.'))
from pyhttpd.env import HttpdTestEnv
def pytest_report_header(config, start_path):
env = HttpdTestEnv()
return f"[apache httpd: {env.get_httpd_version()}, mpm: {env.mpm_module}, {env.prefix}]"
def pytest_addoption(parser):
parser.addoption("--repeat", action="store", type=int, default=1,
help='Number of times to repeat each test')
parser.addoption("--all", action="store_true")
def pytest_generate_tests(metafunc):
if "repeat" in metafunc.fixturenames:
count = int(metafunc.config.getoption("repeat"))
metafunc.fixturenames.append('tmp_ct')
metafunc.parametrize('repeat', range(count))
@pytest.fixture(autouse=True, scope="function")
def _function_scope(env, request):
env.set_current_test_name(request.node.name)
yield
env.set_current_test_name(None)