twister: reports: use Path instead of PosixPath

Directly instantiating a PosixPath is not allowed on Windows, use
Path instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
Benjamin Cabé 2024-12-16 10:50:40 +01:00 committed by Benjamin Cabé
commit 9d4c027993

View file

@ -11,7 +11,7 @@ import string
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from datetime import datetime from datetime import datetime
from enum import Enum from enum import Enum
from pathlib import PosixPath from pathlib import Path, PosixPath
from colorama import Fore from colorama import Fore
from twisterlib.statuses import TwisterStatus from twisterlib.statuses import TwisterStatus
@ -171,7 +171,7 @@ class Reporting:
runnable = suite.get('runnable', 0) runnable = suite.get('runnable', 0)
duration += float(handler_time) duration += float(handler_time)
ts_status = TwisterStatus(suite.get('status')) ts_status = TwisterStatus(suite.get('status'))
classname = PosixPath(suite.get("name","")).name classname = Path(suite.get("name","")).name
for tc in suite.get("testcases", []): for tc in suite.get("testcases", []):
status = TwisterStatus(tc.get('status')) status = TwisterStatus(tc.get('status'))
reason = tc.get('reason', suite.get('reason', 'Unknown')) reason = tc.get('reason', suite.get('reason', 'Unknown'))
@ -253,7 +253,7 @@ class Reporting:
): ):
continue continue
if full_report: if full_report:
classname = PosixPath(ts.get("name","")).name classname = Path(ts.get("name","")).name
for tc in ts.get("testcases", []): for tc in ts.get("testcases", []):
status = TwisterStatus(tc.get('status')) status = TwisterStatus(tc.get('status'))
reason = tc.get('reason', ts.get('reason', 'Unknown')) reason = tc.get('reason', ts.get('reason', 'Unknown'))