Skip to content

Commit

Permalink
Fix report tests for pytest-html >= 2.0.0 (#240)
Browse files Browse the repository at this point in the history
Co-authored-by: PhilippSelenium <PhilippSelenium@github.com>
  • Loading branch information
PhilippSelenium and PhilippSelenium committed Jun 19, 2020
1 parent d1d4ff6 commit 9e4ef72
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions testing/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import re
from distutils.version import LooseVersion

import pytest
from pytest_html import __version__ as PYTEST_HTML_VERSION

pytestmark = pytest.mark.nondestructive

URL_LINK = '<a class="url" href="{0}/" target="_blank">URL</a>'
SCREENSHOT_LINK_REGEX = (
'<a class="image" href=".*" target="_blank">Screenshot</a>'
) # noqa
SCREENSHOT_REGEX = '<div class="image"><a href=".*"><img src=".*"/></a></div>'

if LooseVersion(PYTEST_HTML_VERSION) < LooseVersion("2.0.0"):
SCREENSHOT_LINK_REGEX = '<a class="image" href=".*" target="_blank">Screenshot</a>'
SCREENSHOT_REGEX = '<div class="image"><a href=".*"><img src=".*"/></a></div>'
else:
SCREENSHOT_LINK_REGEX = '<a class="image" href=".*" target="_blank"></a>'
SCREENSHOT_REGEX = (
'<div class="image"><a class="image" href=".*" target="_blank"></a></div>'
)

LOGS_REGEX = '<a class="text" href=".*" target="_blank">.* Log</a>'
HTML_REGEX = '<a class="text" href=".*" target="_blank">HTML</a>'

Expand Down

0 comments on commit 9e4ef72

Please sign in to comment.