pytest: include curl version string and python platform in log

For the Test Clutch matrix.

https://testclutch.curl.se/static/reports/feature-matrix.html

Assisted-by: Dan Fandrich
Closes #15470
This commit is contained in:
Viktor Szakats 2024-11-01 13:18:40 +01:00
parent 9d32724c12
commit 25025419c9
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,7 @@
import logging
import os
import sys
import platform
from typing import Generator
import pytest
@ -38,6 +39,8 @@ def pytest_report_header(config):
env = Env()
report = [
f'Testing curl {env.curl_version()}',
f' platform: {platform.platform()}',
f' curl: Version: {env.curl_version_string()}',
f' curl: Features: {env.curl_features_string()}',
f' curl: Protocols: {env.curl_protocols_string()}',
f' httpd: {env.httpd_version()}, http:{env.http_port} https:{env.https_port}',

View File

@ -68,6 +68,7 @@ class EnvConfig:
if 'CURL' in os.environ:
self.curl = os.environ['CURL']
self.curl_props = {
'version_string': '',
'version': '',
'os': '',
'fullname': '',
@ -88,6 +89,7 @@ class EnvConfig:
self.curl_is_debug = True
for line in p.stdout.splitlines(keepends=False):
if line.startswith('curl '):
self.curl_props['version_string'] = line
m = re.match(r'^curl (?P<version>\S+) (?P<os>\S+) (?P<libs>.*)$', line)
if m:
self.curl_props['fullname'] = m.group(0)
@ -327,6 +329,10 @@ class Env:
return not Env.curl_uses_lib('ngtcp2') and Env.curl_uses_lib('nghttp3')
return False
@staticmethod
def curl_version_string() -> str:
return Env.CONFIG.curl_props['version_string']
@staticmethod
def curl_features_string() -> str:
return Env.CONFIG.curl_props['features_string']