Merge "[Verify] Make total time like H:M:S (<time in sec> s) in HTML report"

This commit is contained in:
Jenkins 2015-11-30 08:30:00 +00:00 committed by Gerrit Code Review
commit 606e48e596
2 changed files with 10 additions and 4 deletions

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import datetime
import re
from jinja2 import utils
@ -51,7 +52,9 @@ def generate_report(results):
return template.render(report={
"tests": tests,
"total": results["tests"],
"time": results["time"],
"time": "{0} ({1} s)".format(
datetime.timedelta(seconds=round(
float(results["time"]))), results["time"]),
"success": results["success"],
"failures": results["failures"],
"skipped": results["skipped"],

View File

@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import datetime
import mock
from rally.verification.tempest import json2html
@ -23,7 +25,7 @@ class HtmlOutputTestCase(test.TestCase):
@mock.patch(BASE + ".json2html.ui_utils.get_template")
def test_generate_report(self, mock_get_template):
results = {
"time": 22,
"time": 22.75,
"tests": 4,
"success": 1,
"skipped": 1,
@ -50,7 +52,8 @@ class HtmlOutputTestCase(test.TestCase):
"expected_failures": 0,
"unexpected_success": 0,
"total": 4,
"time": 22,
"time": "{0} ({1} s)".format(
datetime.timedelta(seconds=23), 22.75),
"tests": [{"name": "tf",
"id": 0,
"output": "fail_log",
@ -96,7 +99,7 @@ class HtmlOutputTestCase(test.TestCase):
"expected_failures": 0,
"unexpected_success": 0,
"total": 1,
"time": 0,
"time": "{0} ({1} s)".format(datetime.timedelta(seconds=0), 0),
"tests": [{
"id": 0,
"status": "skip",