From 8cf38e13b411ebaa75bc146235964ee852913a8a Mon Sep 17 00:00:00 2001 From: AlexButeau Date: Tue, 8 Apr 2025 10:25:45 +0200 Subject: [PATCH 1/4] feat: add logs in the create_run function arguments --- tofupilot/client.py | 6 +++++- tofupilot/models/__init__.py | 2 ++ tofupilot/models/models.py | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) 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..32b44ec 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: Optional[str] + line_number: Optional[int] + + class SubUnit(TypedDict): serial_number: str From 2863039f24ba51cc2c895a8fd695d62dac6ec77b Mon Sep 17 00:00:00 2001 From: Julien Buteau Date: Mon, 5 May 2025 19:36:42 +0200 Subject: [PATCH 2/4] feat: make source_file and line_number required in Log model --- tofupilot/models/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tofupilot/models/models.py b/tofupilot/models/models.py index 32b44ec..8602889 100644 --- a/tofupilot/models/models.py +++ b/tofupilot/models/models.py @@ -59,8 +59,8 @@ class Log(TypedDict): level: LogLevel timestamp: int message: str - source_file: Optional[str] - line_number: Optional[int] + source_file: str + line_number: int class SubUnit(TypedDict): From 96900f6c1ba54401c048adb21fb0a61c3389e2f8 Mon Sep 17 00:00:00 2001 From: Julien Buteau Date: Mon, 5 May 2025 19:36:47 +0200 Subject: [PATCH 3/4] chore: update package author and prepare for new version --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 2cc13e2..2046090 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="tofupilot", - version="1.9.4", + version="1.10.0dev0", 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", From 83f9a35f10f5fe72b1d4ad4e034dd0443605f9dc Mon Sep 17 00:00:00 2001 From: Julien Buteau Date: Tue, 6 May 2025 00:35:53 +0200 Subject: [PATCH 4/4] chore: prepare 1.10.0 release --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2046090..22735a1 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="tofupilot", - version="1.10.0dev0", + version="1.10.0", packages=find_packages(), install_requires=["requests", "setuptools", "packaging", "pytest", "websockets"], entry_points={