-
-
Notifications
You must be signed in to change notification settings - Fork 148
/
conftest.py
55 lines (47 loc) · 1.77 KB
/
conftest.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from test.playground.shared import results
from rich.table import Table
from rich.console import Console
from rich.text import Text
from rich import box
from rich.panel import Panel
def pytest_terminal_summary(terminalreporter, exitstatus, config):
console = Console()
docker_status = (
Text("✔", style="green")
if any(result["activate_docker"] for result in results)
else Text("✘", style="red")
)
runner = results[0]["runner"] if results else "N/A"
cli_type = results[0]["cli_type"] if results else "N/A"
header_panel = Panel.fit(
f"Docker Status: {docker_status}\nRunner: {runner}\nCLI Type: {cli_type}",
title="Execution Summary",
border_style="bold",
)
console.print(header_panel)
table = Table(title="Command Execution Summary", box=box.SQUARE)
table.add_column("Command", width=50)
table.add_column("Description", width=15)
table.add_column("Time Taken", width=15)
table.add_column("Max Memory", width=15)
table.add_column("Status", width=20)
table.add_column("Checkups", width=30)
for result in results:
formatted_checkups = []
for check in result["checkups"]:
if check["status"]:
formatted_checkups.append(
Text("✔", style="green") + f" {check['name']}"
)
else:
formatted_checkups.append(Text("✘", style="red") + f" {check['name']}")
checkups_text = "\n".join(str(checkup) for checkup in formatted_checkups)
table.add_row(
result["command"],
result["description"],
result["time_taken"],
result["max_memory"],
result["status"],
checkups_text,
)
console.print(table)