Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
- name: Install Dependencies
run: |
pip3 install -r requirements.txt
pip3 install -e .
- name: Run Tests
run: |
python3 -m py.test --cov ./pytest_html_reporter/ tests/unit/
python3 -m pytest --cov ./pytest_html_reporter/ tests/unit/
coveralls --service=github
bash <(curl -s https://codecov.io/bash)
352 changes: 326 additions & 26 deletions html/template.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions html_page/page_decor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion pytest_html_reporter/html_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
Empty file added tests/__init__.py
Empty file.
Empty file added tests/functional/__init__.py
Empty file.
1 change: 0 additions & 1 deletion tests/functional/test_screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def __init__(self, driver):
super().__init__(driver)

def setUp(self):
global driver
self.driver = webdriver.Chrome()

def test_demo(self):
Expand Down
Empty file added tests/unit/__init__.py
Empty file.
8 changes: 4 additions & 4 deletions tests/unit/test_mvc_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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()
Expand Down