Skip to content

Commit

Permalink
Merge pull request #187 from prashanth-sams/184
Browse files Browse the repository at this point in the history
  • Loading branch information
prashanth-sams committed Apr 25, 2021
2 parents a5a28f4 + eaea813 commit 0748afa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion pytest_html_reporter/plugin.py
Expand Up @@ -242,6 +242,11 @@ def pytest_terminal_summary(self, terminalreporter, exitstatus, config):
global _execution_time
_execution_time = time.time() - terminalreporter._sessionstarttime

if _execution_time < 60:
_execution_time = str(round(_execution_time, 2)) + " secs"
else:
_execution_time = str(time.strftime("%H:%M:%S", time.gmtime(round(_execution_time)))) + " Hrs"

global _total
_total = _pass + _fail + _xpass + _xfail + _skip + _error

Expand Down Expand Up @@ -663,7 +668,7 @@ def _test_error(self, value):
def renew_template_text(self, logo_url):
template_text = html_template()
template_text = template_text.replace("__custom_logo__", logo_url)
template_text = template_text.replace("__execution_time__", str(round(_execution_time, 2)))
template_text = template_text.replace("__execution_time__", str(_execution_time))
# template_text = template_text.replace("__executed_by__", str(platform.uname()[1]))
# template_text = template_text.replace("__os_name__", str(platform.uname()[0]))
# template_text = template_text.replace("__python_version__", str(sys.version.split(' ')[0]))
Expand Down
6 changes: 3 additions & 3 deletions pytest_html_reporter/template.py
Expand Up @@ -514,10 +514,10 @@ def html_template():
<div class="col-md-6 card" style="max-width: 49%;">
<div style="width:100%;height:500px;text-align: center;">
<div class="card__content">
<div style="margin-bottom: -4%; margin-left: 40%;">
<div style="margin-bottom: -4%; margin-left: 30%;">
<span style="color: darkgray; font-size: 17px;">
<svg width="22px" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" style="margin: -1% 2% 0% 29%; -ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1536 1536"><path d="M896 416v448q0 14-9 23t-23 9H544q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h224V416q0-14 9-23t23-9h64q14 0 23 9t9 23zm416 352q0-148-73-273t-198-198t-273-73t-273 73t-198 198t-73 273t73 273t198 198t273 73t273-73t198-198t73-273zm224 0q0 209-103 385.5T1153.5 1433T768 1536t-385.5-103T103 1153.5T0 768t103-385.5T382.5 103T768 0t385.5 103T1433 382.5T1536 768z" fill="#a9a9a9"/></svg>
Time taken __execution_time__ secs
Time taken __execution_time__
</span>
</div>
<div>
Expand All @@ -538,7 +538,7 @@ def html_template():
</div>
<div>
<div style="margin-left: 50%;margin-top: -43%; max-height: 43%;">
<canvas id="myChart" style="margin-top: 16%; height: 41%; margin-left: 16%; max-width: 75%;"></canvas>
<canvas id="myChart" style="margin-top: 16%; height: 38%; margin-left: 16%; max-width: 75%;"></canvas>
</div>
</div>
<div style="margin-top: 23%;position: static;">
Expand Down

0 comments on commit 0748afa

Please sign in to comment.