Skip to content

Commit

Permalink
Merge pull request #182 from prashanth-sams/175
Browse files Browse the repository at this point in the history
  • Loading branch information
prashanth-sams committed Apr 20, 2021
2 parents 4267c37 + a45c030 commit 3eb2dc9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -46,7 +46,7 @@ Installation

.. code-block:: console
$ pip install pytest-html-reporter
$ pip3 install pytest-html-reporter
Usage
Expand Down
10 changes: 6 additions & 4 deletions pytest_html_reporter/plugin.py
Expand Up @@ -8,7 +8,6 @@
import json
import glob
from collections import Counter
import codecs
from PIL import Image
from io import BytesIO
import shutil
Expand Down Expand Up @@ -184,9 +183,12 @@ def __init__(self, path, config):
self.rerun = 0 if has_rerun else None

def pytest_runtest_teardown(self, item, nextitem):
global _test_name
global _test_name, _duration
_test_name = item.name

_test_end_time = time.time()
_duration = _test_end_time - _start_execution_time

if (self.rerun is not None) and (max_rerun() is not None): self.previous_test_name(_test_name)
self._test_names(_test_name)
self.append_test_metrics_row()
Expand All @@ -203,7 +205,7 @@ def previous_test_name(self, _test_name):

def pytest_runtest_setup(item):
global _start_execution_time
_start_execution_time = round(time.time())
_start_execution_time = time.time()

def pytest_sessionfinish(self, session):
if _suite_name is not None: self.append_suite_metrics_row(_suite_name)
Expand Down Expand Up @@ -343,7 +345,7 @@ def pytest_runtest_makereport(self, item, call):
self.update_test_error(longerr)

def append_test_metrics_row(self):
global _test_metrics_content, _pvalue
global _test_metrics_content, _pvalue, _duration

test_row_text = """
<tr>
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -13,7 +13,7 @@ def read(fname):

setup(
name="pytest-html-reporter",
version="0.2.4",
version="0.2.5",
author="Prashanth Sams",
author_email="sams.prashanth@gmail.com",
maintainer="Prashanth Sams",
Expand Down

0 comments on commit 3eb2dc9

Please sign in to comment.