Skip to content

Commit 7a03be8

Browse files
Merge remote-tracking branch 'upstream/main' into feature/BCSS-20899
2 parents eeafd72 + 23a465f commit 7a03be8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

conftest.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66

77
import pytest
88
import os
9+
import typing
910
from dotenv import load_dotenv
1011
from pathlib import Path
12+
from _pytest.python import Function
13+
from pytest_html.report_data import ReportData
1114
from utils.load_properties_file import PropertiesFile
1215

16+
# Environment Variable Handling
17+
1318
LOCAL_ENV_PATH = Path(os.getcwd()) / "local.env"
1419

1520

@@ -35,3 +40,27 @@ def smokescreen_properties() -> dict:
3540
@pytest.fixture
3641
def general_properties() -> dict:
3742
return PropertiesFile().get_general_properties()
43+
44+
45+
# HTML Report Customization
46+
47+
48+
def pytest_html_report_title(report: ReportData) -> None:
49+
report.title = "BCSS Test Automation Report"
50+
51+
52+
def pytest_html_results_table_header(cells: list) -> None:
53+
cells.insert(2, "<th>Description</th>")
54+
55+
56+
def pytest_html_results_table_row(report: object, cells: list) -> None:
57+
description = getattr(report, "description", "N/A")
58+
cells.insert(2, f"<td>{description}</td>")
59+
60+
61+
@pytest.hookimpl(hookwrapper=True)
62+
def pytest_runtest_makereport(item: Function) -> typing.Generator[None, None, None]:
63+
outcome = yield
64+
if outcome is not None:
65+
report = outcome.get_result()
66+
report.description = str(item.function.__doc__)

0 commit comments

Comments
 (0)