Description
I have following code to generate screenshots in reports
if xfail or report.failed:
**extra.append(pytest_html.extras.image(pytest.driver.get_screenshot_as_base64(), ''))**
extra.append(pytest_html.extras.html('<div><h2 style="color: red; ">{}</h2></div>'.format(test_name)))
elif report.passed:
extra.append(pytest_html.extras.html(
'<div><h2 style="color: black; text-decoration: underline">{}</h2></div>'.format(test_name)))
pytest_html.extras.html('<div style="color: black; margin: 10px;">'.format(test_name))
for step in test_steps:
extra.append(pytest_html.extras.html('<p style="margin: 5px;">{}</p>'.format(step)))
pytest_html.extras.html('</div>')
report.extra = extra
And you have line in plugin.py where you get file content and validate if its path. And in my case file content contains binary representation of image. When windows is trying to validate this long path, it fails into INTERNAL ERROR.
INTERNALERROR> File "c:\python36\lib\site-packages\pytest_html\plugin.py", line 112, in init
INTERNALERROR> self.append_extra_html(extra, extra_index, test_index)
INTERNALERROR> File "c:\python36\lib\site-packages\pytest_html\plugin.py", line 164, in append_extra_html
INTERNALERROR> os.path.isfile(content):
INTERNALERROR> File "c:\python36\lib\genericpath.py", line 30, in isfile
INTERNALERROR> st = os.stat(path)
INTERNALERROR> ValueError: stat: path too long for Windows