forked from microsoft/CopilotStudioSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
35 lines (30 loc) · 1.29 KB
/
Copy pathconftest.py
File metadata and controls
35 lines (30 loc) · 1.29 KB
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
34
35
import pytest
from py.xml import html
def pytest_html_results_table_header(cells):
del cells[1] # Remove the default "Test" column
cells.insert(1, html.th("User input"))
cells.insert(2, html.th("Expected"))
cells.insert(3, html.th("Actual"))
cells.insert(4, html.th("Score"))
cells.insert(5, html.th("Reason"))
cells.insert(6, html.th("Conversation ID"))
def pytest_html_results_table_row(report, cells):
del cells[1] # Remove the default "Test" cell
input_text = getattr(report, 'input_text', '')
expected = getattr(report, 'expected', '')
actual = getattr(report, 'actual', '')
score = getattr(report, 'score', '')
reason = getattr(report, 'reason', '')
conversation_id = getattr(report, 'conversation_id', '')
cells.insert(1, html.td(input_text))
cells.insert(2, html.td(expected))
cells.insert(3, html.td(actual, title=actual))
cells.insert(4, html.td(score))
cells.insert(5, html.td(reason, title=reason))
cells.insert(6, html.td(conversation_id))
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
for attr in ["input_text", "expected", "actual", "score", "reason", "conversation_id"]:
setattr(report, attr, getattr(item, attr, ''))