Source code for testsuite.tracing
from __future__ import annotations
[docs]
class TraceidManager:
def __init__(self, trace_id: str, history: set[str]):
self._trace_id = trace_id
self._history = history
@property
def trace_id(self) -> str:
"""Current testcase trace_id value."""
return self._trace_id
[docs]
def is_testsuite(self, trace_id: str | None) -> bool:
"""Returns True when `trace_id` was generated by testsuite."""
if trace_id is None:
return False
return trace_id in self._history
[docs]
def is_other_test(self, trace_id: str | None) -> bool:
"""Returns True when trace_id was generated by one of the previous testcases."""
if trace_id == self.trace_id:
return False
return self.is_testsuite(trace_id)