pw_presubmit: Use integers for timeout displays
Very little additional information is contained in
"54.0m2.3438949584960938s" vs "54m2s".
Change-Id: If717230ab889fe4ea6c024e0896515442f5add94
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/97898
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
diff --git a/recipe_modules/pw_presubmit/api.py b/recipe_modules/pw_presubmit/api.py
index 30793f2..ef125a5 100644
--- a/recipe_modules/pw_presubmit/api.py
+++ b/recipe_modules/pw_presubmit/api.py
@@ -51,9 +51,9 @@
def _hms_format(timeout):
- seconds = timeout % 60
- minutes = (timeout // 60) % 60
- hours = (timeout // 3600)
+ seconds = int(timeout % 60)
+ minutes = int((timeout // 60) % 60)
+ hours = int(timeout // 3600)
if hours:
return '{}h{}m{}s'.format(hours, minutes, seconds)
diff --git a/recipe_modules/pw_presubmit/tests/full.expected/long.json b/recipe_modules/pw_presubmit/tests/full.expected/long.json
index 4ae03dc..8d54fd0 100644
--- a/recipe_modules/pw_presubmit/tests/full.expected/long.json
+++ b/recipe_modules/pw_presubmit/tests/full.expected/long.json
@@ -5,7 +5,7 @@
},
{
"cmd": [],
- "name": "step1.timeout 2.0h58.0m40.0s",
+ "name": "step1.timeout 2h58m40s",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -371,7 +371,7 @@
},
{
"cmd": [],
- "name": "step2.timeout 2.0h58.0m20.0s",
+ "name": "step2.timeout 2h58m20s",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipe_modules/pw_presubmit/tests/full.expected/medium.json b/recipe_modules/pw_presubmit/tests/full.expected/medium.json
index 391ba47..30bbf54 100644
--- a/recipe_modules/pw_presubmit/tests/full.expected/medium.json
+++ b/recipe_modules/pw_presubmit/tests/full.expected/medium.json
@@ -5,7 +5,7 @@
},
{
"cmd": [],
- "name": "step1.timeout 28.0m40.0s",
+ "name": "step1.timeout 28m40s",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -371,7 +371,7 @@
},
{
"cmd": [],
- "name": "step2.timeout 28.0m20.0s",
+ "name": "step2.timeout 28m20s",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipe_modules/pw_presubmit/tests/full.expected/step.json b/recipe_modules/pw_presubmit/tests/full.expected/step.json
index c50e771..0679a92 100644
--- a/recipe_modules/pw_presubmit/tests/full.expected/step.json
+++ b/recipe_modules/pw_presubmit/tests/full.expected/step.json
@@ -5,7 +5,7 @@
},
{
"cmd": [],
- "name": "step1.timeout 40.0s",
+ "name": "step1.timeout 40s",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/pw_presubmit.expected/step.json b/recipes/pw_presubmit.expected/step.json
index 9ebf5cd..5e2eedf 100644
--- a/recipes/pw_presubmit.expected/step.json
+++ b/recipes/pw_presubmit.expected/step.json
@@ -1553,7 +1553,7 @@
},
{
"cmd": [],
- "name": "step1.timeout 40.0s",
+ "name": "step1.timeout 40s",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]