-
-
+
+
-
+
-
Time taken %(execution_time)%
@@ -788,7 +1035,7 @@
+
@@ -1116,7 +1363,7 @@
-
diff --git a/html_page/page_decor.py b/html_page/page_decor.py
index c44e590..87f6a14 100644
--- a/html_page/page_decor.py
+++ b/html_page/page_decor.py
@@ -48,14 +48,14 @@ def content(self):
@property
def inline_attributes(self):
if not self.__inline_attributes:
- self.__inline_attributes = re.findall("%\((.+?)\)%", self.content)
+ self.__inline_attributes = re.findall(r"%\((.+?)\)%", self.content)
return self.__inline_attributes
@property
def inline_code_snippets(self):
if not self.__inline_code_snippets:
- self.__inline_code_snippets = re.findall("\$\((.+?)\)$", self.content)
+ self.__inline_code_snippets = re.findall(r"\$\((.+?)\)$", self.content)
return self.__inline_code_snippets
diff --git a/pytest_html_reporter/html_reporter.py b/pytest_html_reporter/html_reporter.py
index e082c7b..083564b 100644
--- a/pytest_html_reporter/html_reporter.py
+++ b/pytest_html_reporter/html_reporter.py
@@ -29,6 +29,10 @@ def __init__(self, path, archive_count, config):
self.config = config
has_rerun = config.pluginmanager.hasplugin("rerunfailures")
self.rerun = 0 if has_rerun else None
+ self._sessionstarttime = None
+
+ def pytest_sessionstart(self, session):
+ self._sessionstarttime = time.time()
def pytest_runtest_teardown(self, item, nextitem):
ConfigVars._test_name = item.name
@@ -99,7 +103,7 @@ def remove_old_archives(self):
def pytest_terminal_summary(self, terminalreporter, exitstatus, config):
yield
- _execution_time = time.time() - terminalreporter._sessionstarttime
+ _execution_time = time.time() - self._sessionstarttime
if ConfigVars._execution_time < 60:
ConfigVars._execution_time = str(round(_execution_time, 2)) + " secs"
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/functional/__init__.py b/tests/functional/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/functional/test_screenshot.py b/tests/functional/test_screenshot.py
index 2c883d3..78d4ac3 100644
--- a/tests/functional/test_screenshot.py
+++ b/tests/functional/test_screenshot.py
@@ -10,7 +10,6 @@ def __init__(self, driver):
super().__init__(driver)
def setUp(self):
- global driver
self.driver = webdriver.Chrome()
def test_demo(self):
diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/unit/test_mvc_pages.py b/tests/unit/test_mvc_pages.py
index 0e806d4..cb4c0d3 100644
--- a/tests/unit/test_mvc_pages.py
+++ b/tests/unit/test_mvc_pages.py
@@ -10,7 +10,7 @@
from html_page.suite_row import SuiteRow
from html_page.template import HtmlTemplate
from html_page.test_row import TestRow
-from tests.unit.helper import get_random_number, get_random_string
+from .helper import get_random_number, get_random_string
def test_archive_body():
@@ -129,12 +129,12 @@ def test_screenshot_details():
assert tc_row.findAll("span")[1].text.strip() == te
ts_p = soup.find("p", class_="text-desc")
- assert re.search(f"{ts}[\n\s]+{te}", ts_p.text.strip()), ts_p.text.strip()
+ assert re.search(rf"{ts}[\n\s]+{te}", ts_p.text.strip()), ts_p.text.strip()
assert ts_p.find("strong").text.strip() == ts
video_description = soup.find("div", id="Video-desc-01")
assert video_description.find("h2").text.strip() == tc
- assert re.search(f"{ts}[\n\s]+{te}", video_description.find("p").text.strip())
+ assert re.search(rf"{ts}[\n\s]+{te}", video_description.find("p").text.strip())
assert video_description.find("strong").text.strip() == ts
@@ -172,7 +172,7 @@ def test_test_row():
for node, expected in zip(cells[:-1], [sname, name, stat, dur]):
assert node.text.strip() == expected
- assert re.search(f"{msg}[\s\n]*{floating_error_text}", cells[-1].text.strip())
+ assert re.search(rf"{msg}[\s\n]*{floating_error_text}", cells[-1].text.strip())
def test_template():
custom_logo = get_random_string()