summaryrefslogtreecommitdiffstats
path: root/test/modules/tls/conftest.py
blob: c7cb85877d533c700bb9607cfb5e0efa1e043b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import logging
import os
import sys
import pytest

sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))

from .env import TlsTestEnv


def pytest_report_header(config, startdir):
    _x = config
    _x = startdir
    env = TlsTestEnv()
    return "mod_tls [apache: {aversion}({prefix})]".format(
        prefix=env.prefix,
        aversion=env.get_httpd_version()
    )


@pytest.fixture(scope="package")
def env(pytestconfig) -> TlsTestEnv:
    level = logging.INFO
    console = logging.StreamHandler()
    console.setLevel(level)
    console.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
    logging.getLogger('').addHandler(console)
    logging.getLogger('').setLevel(level=level)
    env = TlsTestEnv(pytestconfig=pytestconfig)
    env.setup_httpd()
    env.apache_access_log_clear()
    env.httpd_error_log.clear_log()
    return env