Skip to content

Commit 3eb2dc9

Browse files
Merge pull request #182 from prashanth-sams/175
#175
2 parents 4267c37 + a45c030 commit 3eb2dc9

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Installation
4646

4747
.. code-block:: console
4848
49-
$ pip install pytest-html-reporter
49+
$ pip3 install pytest-html-reporter
5050
5151
5252
Usage

pytest_html_reporter/plugin.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import json
99
import glob
1010
from collections import Counter
11-
import codecs
1211
from PIL import Image
1312
from io import BytesIO
1413
import shutil
@@ -184,9 +183,12 @@ def __init__(self, path, config):
184183
self.rerun = 0 if has_rerun else None
185184

186185
def pytest_runtest_teardown(self, item, nextitem):
187-
global _test_name
186+
global _test_name, _duration
188187
_test_name = item.name
189188

189+
_test_end_time = time.time()
190+
_duration = _test_end_time - _start_execution_time
191+
190192
if (self.rerun is not None) and (max_rerun() is not None): self.previous_test_name(_test_name)
191193
self._test_names(_test_name)
192194
self.append_test_metrics_row()
@@ -203,7 +205,7 @@ def previous_test_name(self, _test_name):
203205

204206
def pytest_runtest_setup(item):
205207
global _start_execution_time
206-
_start_execution_time = round(time.time())
208+
_start_execution_time = time.time()
207209

208210
def pytest_sessionfinish(self, session):
209211
if _suite_name is not None: self.append_suite_metrics_row(_suite_name)
@@ -343,7 +345,7 @@ def pytest_runtest_makereport(self, item, call):
343345
self.update_test_error(longerr)
344346

345347
def append_test_metrics_row(self):
346-
global _test_metrics_content, _pvalue
348+
global _test_metrics_content, _pvalue, _duration
347349

348350
test_row_text = """
349351
<tr>

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def read(fname):
1313

1414
setup(
1515
name="pytest-html-reporter",
16-
version="0.2.4",
16+
version="0.2.5",
1717
author="Prashanth Sams",
1818
author_email="sams.prashanth@gmail.com",
1919
maintainer="Prashanth Sams",

0 commit comments

Comments
 (0)