diff --git a/setup.py b/setup.py index 2cc13e2..22735a1 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="tofupilot", - version="1.9.4", + version="1.10.0", packages=find_packages(), install_requires=["requests", "setuptools", "packaging", "pytest", "websockets"], entry_points={ @@ -13,8 +13,8 @@ "tofupilot = tofupilot.plugin", # Registering the pytest plugin ], }, - author="Félix Berthier", - author_email="felix.berthier@tofupilot.com", + author="TofuPilot", + author_email="hello@tofupilot.com", description="The official Python client for the TofuPilot API", license="MIT", keywords="automatic hardware testing tofupilot", diff --git a/tofupilot/client.py b/tofupilot/client.py index 56e7427..9cf5ede 100644 --- a/tofupilot/client.py +++ b/tofupilot/client.py @@ -17,7 +17,7 @@ CLIENT_MAX_ATTACHMENTS, SECONDS_BEFORE_TIMEOUT, ) -from .models import SubUnit, UnitUnderTest, Step, Phase +from .models import SubUnit, UnitUnderTest, Step, Phase, Log from .utils import ( check_latest_version, validate_files, @@ -76,6 +76,7 @@ def create_run( # pylint: disable=too-many-arguments,too-many-locals sub_units: Optional[List[SubUnit]] = None, report_variables: Optional[Dict[str, str]] = None, attachments: Optional[List[str]] = None, + logs: Optional[List[Log]] = None, ) -> dict: """ Creates a test run with the specified parameters and uploads it to the TofuPilot platform. @@ -139,6 +140,9 @@ def create_run( # pylint: disable=too-many-arguments,too-many-locals if phases is not None: payload["phases"] = phases + if logs is not None: + payload["logs"] = logs + if started_at is not None: payload["started_at"] = datetime_to_iso(started_at) diff --git a/tofupilot/models/__init__.py b/tofupilot/models/__init__.py index 33f9bd6..78c2838 100644 --- a/tofupilot/models/__init__.py +++ b/tofupilot/models/__init__.py @@ -5,6 +5,7 @@ Phase, MeasurementOutcome, PhaseOutcome, + Log, ) __all__ = [ @@ -14,4 +15,5 @@ "Phase", "MeasurementOutcome", "PhaseOutcome", + "Log", ] diff --git a/tofupilot/models/models.py b/tofupilot/models/models.py index c7249c0..8602889 100644 --- a/tofupilot/models/models.py +++ b/tofupilot/models/models.py @@ -47,6 +47,22 @@ class Phase(TypedDict): docstring: Optional[str] +class LogLevel(str, Enum): + DEBUG = "DEBUG" + INFO = "INFO" + WARNING = "WARNING" + ERROR = "ERROR" + CRITICAL = " CRITICAL" + + +class Log(TypedDict): + level: LogLevel + timestamp: int + message: str + source_file: str + line_number: int + + class SubUnit(TypedDict): serial_number: str