Skip to content

Commit

Permalink
Add commit message decsription in overview table.
Browse files Browse the repository at this point in the history
  • Loading branch information
Karan Desai committed Jul 21, 2016
1 parent bf6d4d2 commit 842e3dc
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tardis/tests/tests_slow/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
3. "pytest-html" ( https://www.github.com/davehunt/pytest-html )
"""
import datetime
import pkg_resources
import json
import os
import pkg_resources
import time

# For specifying error while exception handling
Expand All @@ -39,8 +40,10 @@

try:
import dokuwiki
import requests
except ImportError:
dokuwiki = None
requests = None


class DokuReport(HTMLReport):
Expand Down Expand Up @@ -175,9 +178,26 @@ def _wiki_overview_entry(self):
else:
status = "Errored"

# Fetch commit message from github.
gh_request = requests.get(
"https://api.github.com/repos/tardis-sn/tardis/git/commits/{0}".format(
tardis.__githash__
)
)
gh_commit_data = json.loads(gh_request.content)
# Pick only first line of commit message
gh_commit_message = gh_commit_data['message'].split('\n')[0]

# Truncate long commit messages
if len(gh_commit_message) > 40:
gh_commit_message = "{0}...".format(gh_commit_message[:37])
row = "| "
# Append hash
row += "[[reports:{0}|{0}]] | ".format(tardis.__githash__[:7])
# Append commit message
row += "[[https://www.github.com/tardis-sn/tardis/commit/{0}|{1}]] | ".format(
tardis.__githash__, gh_commit_message
)
# Append start time
row += "{0} | ".format(self.suite_start_datetime)
# Append time elapsed
Expand Down

0 comments on commit 842e3dc

Please sign in to comment.